Sign in to follow this  
t5hoo6

Can any one help me?

Recommended Posts

t5hoo6    100
I ran into a problem compiling. this is the program, it is a demo: #include <stdio.h> int main () { char c; FILE * pFile; pFile = fopen ("myfile.txt","w+t"); if (pFile!=NULL) { fputs ("Welcom to Cp \"ZUF\"",pFile); { do { c = fgetc (pFile); } while (c != EOF); fclose (pFile); } printf ("File contains %d$.\n",c); return 0; } The error is: [Error]C:\progra~1\c-free~1.5\temp\untitled1.cpp:19:prase error at end of input line 18 is the last line I have had 20 and instead of ...:19:... it was ...:21:... I cannot find the error!!!!!!

Share this post


Link to post
Share on other sites
Drew_Benton    1861
As mumpo has said:


#include <stdio.h>
int main()
{
char c;
FILE * pFile;
pFile = fopen ("myfile.txt","w+t");
if (pFile!=NULL)
{
fputs ("Welcom to Cp \"ZUF\"",pFile);
// {
do
{
c = fgetc (pFile);
}
while (c != EOF);
fclose (pFile);
}
printf ("File contains %d$.\n",c);
return 0;
}





You can use the You can use the [source] [/source] tags to format your code so it looks like that as well [wink]

[edit]You might also want to increase your tab indent as well to help catch things like this as well. I think I have mine set on 4. I looked at the formating on your OP and it looks kinda small. Just a suggestion though.

Share this post


Link to post
Share on other sites
Sign in to follow this