problem with open file.
Hi, i have a problem.
i have a file that there is a line in the file : #include "hello.h"
i have to open the "hello.h" file and copy it to another file.
i did :
fp1 = strchr(getline2,'#'); /* fp1 = #include ..., taking the include from the line */
fp1 = strchr(fp1,'"'); /* fp1 = "hello.h" */
FILE *file = fopen(fp1,"w");
the file hello.h is in the main libary and the file not opened.
i hope i was understandable, and if someone can help me i`ll appreciate it.
Re: problem with open file.
You need to created a file stream to open the file. Try the code below I'm rusty in C++ but to open a file you need to create a new fstream, you also need to include fstream, and istream if you want to read and open the file. In C you would use fopen and fread functions instead. Make sure your directory for the hello.h is correct that maybe why its not being included and causing the compile error.
|All times are GMT +5.5. The time now is 16:34.|