[edit]^^^ beat me to it

[/edit]
>>fscanf(inFile, "%s", text)
>>printf("%s\n", text);
I don't know why the file doesn't open, but the above line is guarenteed to crash. Why? Because "%s" tells scanf() and printf() the next argument (text) is a null-terminated character array, and all you passed is a single character. You can fix that problem by declaring text something like this:
char text[255];
As for the problem you reported, try entering the full path to the file. But you have to increase the size of FileName so that it can hold all the characters.
Finally, never ever use gets() because its so unsafe. Use fgets() instead like this:
fgets(filename, sizeof(filename), stdin); Now the drawback with fgets() is that it will append the '\n' (Enter key), so you have to strip it off before using the filename variable.
Last edited by Ancient Dragon; Jan 4th, 2009 at 3:32 pm.
Sponsor
Team Colleague
Featured Poster
Reputation Points: 5608
Solved Threads: 2282
Retired and Enjoying Life
Offline 21,951 posts
since Aug 2005