Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
C Programming
A little rusty on pointers to pointers
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="Sam, post: 3638793"] Hi there. I hope this code is standard C. I think it is. Anyway, I haven't used C in a Looooooong time and am a little rusty on pointers. I am wondering why "buff" is a pointer to a pointer instead of just "*buff". I'm also not really sure about the language of pointers. Is it correct to say "pointer to a pointer to buff" or "double pointer to buff" or what? If you can help me with this, you have my thanks... REM --- *Code Below* --- void LoadFileIntoMemory(const char *name, void **buff, int *length) { FILE *fp = fopen(name, "rb"); fseek(fp, 0, SEEK_END); *length = ftell(fp); fseek(fp, 0, SEEK_SET); *buff = malloc(*length); fread(*buff, *length, 1, fp); fclose(fp); } REM --- *End Code* --- [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
C Programming
A little rusty on pointers to pointers
Top