Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | jgk@panix.com (Joe keane) |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: old c |
| Date | 2016-09-28 21:02 +0000 |
| Organization | Public Access Networks Corp. |
| Message-ID | <nshb59$pmr$1@reader2.panix.com> (permalink) |
| References | <qr5fub15dtp0k7pn5f8757638pfergcnhk@4ax.com> <d2bac960-66bb-4c28-97ec-22c6fa35f244@googlegroups.com> |
In article <d2bac960-66bb-4c28-97ec-22c6fa35f244@googlegroups.com>,
luser droog <luser.droog@gmail.com> wrote:
>One technique you can use to get pointer-like behavior
>from (implicit) ints is to use the integer values as
>offsets or *cursors*. For most unix-like platforms I
>have used, you can use the `brk()` system call to get
>a base-pointer that can be used to access heap memory
>with cursors.
>
>#include<unistd.h>
>int x;
>char*mem;
>main(){
> mem=brk();
> x=strdup("Hello, World!")-mem;
> printf("%s\n", &mem[x]);
>}
Why?
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
old c Rosario19 <Ros@invalid.invalid> - 2016-09-25 11:41 +0200
Re: old c Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-09-25 11:24 +0100
Re: old c Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-09-28 21:08 -0700
Re: old c Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-09-29 11:01 +0100
Re: old c Jerry Stuckle <jstucklex@attglobal.net> - 2016-09-29 10:11 -0400
Re: old c Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-09-29 17:13 +0100
Re: old c Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-09-29 09:51 -0700
Re: old c Jerry Stuckle <jstucklex@attglobal.net> - 2016-09-29 17:15 -0400
Re: old c supercat@casperkitty.com - 2016-09-30 08:03 -0700
Re: old c luser droog <luser.droog@gmail.com> - 2016-09-25 11:13 -0700
Re: old c jgk@panix.com (Joe keane) - 2016-09-28 21:02 +0000
Re: old c luser droog <luser.droog@gmail.com> - 2016-09-28 15:28 -0700
csiph-web