Xref: news2.mv.net comp.os.msdos.djgpp:7855 From: sam AT beavis DOT u-net DOT com (Sam) Newsgroups: comp.os.msdos.djgpp Subject: Getc(), putc() and feof() acting very wierdly Date: Sun, 25 Aug 1996 02:08:32 GMT Organization: U-NET limited Lines: 41 Message-ID: <4vockq$ri5@nuntius.u-net.net> Reply-To: sam AT beavis DOT u-net DOT com NNTP-Posting-Host: beavis.u-net.com To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Hiya, this is my first post to this group, so I'd like to thank DJ Delorie for writing DJGPP. Now for my problem. I've written a very simple program to change the Windows wallpaper by copying one BMP to another. It randomly picks a BMP and copies it. Normally it works as expected, but a couple of files only copy the first few K, an 8578 byte file only gets to 1210 bytes. It all exits as normal, and it all looks the most standard C I can write. The copying routine is void copyfile() { int count=0; while(feof(infile)==0) { putc(getc(infile), outfile); count++; } printf("\n%d bytes copied!\n", count); } which is about as simple as I can think of. Infile and outfile are both FILE * s, and are opened and closed with fopen and fclose as mode "r" and "w". I also tried while(getc(infile)!=EOF) and got exactly the same problem. I hope I'm not being stupid in asking, but this is bizarre to me, I honestly haven't a clue what it can be. Thank you for any help, Sam. ------------------------------------------------------------------------ "Where am I" - Charlie Chuck. sam AT beavis DOT u-net DOT com http://www.u-net.com/~beavis/renstimp.htm