View Full Version : Pointers from pipes
sicarius
08-03-2002, 02:11 AM
I know that it is possible to print a pointer (i.e. printf("%p", ptr); ), and possible to read a pointer (i.e. scanf("%p", optr); ). Knowing this, is it possible to write a pointer to a pipe, and then read that pointer in from a child process? It seems to me that the answer would be know, but I just had to ask. Of course when I say read the pointer I mean actually be able to access the data it points to.
edited because ; ) became a smiley...
Bradmont
08-03-2002, 04:10 AM
I doubt it'd work, you'd probably end up with a segmentation fault if you tried to access the pointer's data.
sans-hubris
08-03-2002, 12:22 PM
I agree with Bradmont. It is highly likely that the OS' permissions are set up to prevent one program from accessing the memory of another program.
sicarius
08-06-2002, 12:18 PM
yeah, on linux it didn't segfault, it just gave me bogus data. I guess the pointer address is relative to each process own memory.
thanks for the input guys.
vBulletin® v3.7.0, Copyright ©2000-2009, Jelsoft Enterprises Ltd.