OK I this code and get the following errors
Code:
12 c:\mjm7ss~1.cpp incompatible types in assignment of `int' to `char[260]'
14 c:\mjm7ss~1.cpp passing `char *' to argument 1 of `putchar(int)' lacks a cast
16 c:\mjm7ss~1.cpp ANSI C++ forbids comparison between pointer and integer
Code:
#include <stdio.h>
#include <stdlib.h>
main( )
{
FILE *text;
char fname[MAX_PATH];
printf("Please enter file name to open:\n");
fgets(fname, sizeof(fname), stdin);
if (text == NULL) printf("File doesn't exist\n");
else {
do {
fname = getc(text); /* get one character from the file
*/
putchar(fname); /* display it on the monitor
*/
} while (fname != EOF); /* repeat until EOF (end of file)
*/
}
fclose(text);
system("PAUSE");
}