Forum Moderators: phranque
I am looking for a simple method ie. preferable a function in C which does the same thing as the PHP function without using a library such as libcurl which needs compiling etc. I'm using gcc to compile and have only half managed to write one which involves -lsocket and -lnsl
Thank you all
PS. Hope this thread is correctly placed in the forums
You'll create a file handler:
FILE* fp;
And then you will open the file with fopen, read everything from it in the string and close it. Now, how to read everything from it to a string variable? One way is to get the file length and dynamically create a string, holding such ammount of characters, so no overflow may occur. You should use malloc() to create your string.
I haven't touched C in...two years...and I'm sorry if I wasn't helpful enough.