Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C > Re: extra chara...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 3 of 9 Topic 25476 of 28006
Post > Topic >>

Re: extra character when writing file

by Peter Nilsson <airia@[EMAIL PROTECTED] > Apr 9, 2008 at 09:12 PM

Jim wrote:
> Hi There,
>
> I'm trying to read a file character by character.  When I write the
> file out, there is one extra character which shows on the screen as a
> solid circle with a small question mark in the middle.
>
> Here is what I have:
>
> 	infile = fopen("encrypted.txt", "r");
> 	outfile = fopen("plain.txt", "w");
>
> 	while(!feof(infile)) {
> 		ch = fgetc(infile);
> 		fputc(ch, outfile);
> 	}
>
>         fclose(infile);
>         fclose(outfile);
>
> Can someone please tell me why this character is getting added to the
> outfile?

This is a FAQ...

  http://c-faq.com/stdio/feof.html

--
Peter
 




 9 Posts in Topic:
extra character when writing file
Jim <jim.moneytime@[EM  2008-04-09 20:33:38 
Re: extra character when writing file
Richard Heathfield <rj  2008-04-10 04:03:44 
Re: extra character when writing file
Peter Nilsson <airia@[  2008-04-09 21:12:29 
Re: extra character when writing file
Jim <jim.moneytime@[EM  2008-04-09 21:15:08 
Re: extra character when writing file
Richard Heathfield <rj  2008-04-10 04:30:08 
Re: extra character when writing file
"Bartc" <bc@  2008-04-10 09:09:17 
Re: extra character when writing file
Willem <willem@[EMAIL   2008-04-10 09:22:28 
Re: extra character when writing file
"Bartc" <bc@  2008-04-10 10:26:08 
Re: extra character when writing file
CBFalconer <cbfalconer  2008-04-10 10:36:36 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Nov 21 10:59:15 CST 2008.