[windows] 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 :

char getline[MAX_LINE];
char *fp1;


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.
Thanks,
Or.



[code] "Your code goes here" [/code]
print the content of fp1, I think that you will get
hello.h"

The file should be located where you call at your program.

Also getline2 is not defined or initiallized.
Just a quick question... is there a specific reason why you use C?
Well... you never declared getline2. You never defined getline. You didn't declare MAX_LINE.

Anyways. The file is not opened because the filename you pass to fopen is
"hello.h\"" - you forgot about the second \"
Last edited on
Topic archived. No new replies allowed.