|
|
back to boardI used this and it works (+) fraction of my C/C++ code , text reading part ... ... char temp[100000]; int tempsize; int c; ... ... tempsize=0; while ((c=fgetc(stdin))!=EOF) { temp[tempsize++]=c; } tempsize-=2; // cut the empty line at the end of input ... ... I got WA but if I change it to ... ... char temp[100000]; int tempsize; int c; ... ... tempsize=0; // CHANGEs HERE !!! while (feof(stdin)) { temp[tempsize++]=fgetc(stdin); } tempsize-=2; // cut the empty line at the end of input ... ... I got AC. I don't know why , but I think it might be useful for others. Re: I used this and it works (+) Posted by ruX 25 Dec 2006 01:07 Yes, you are right my c++ program recieve WA#6 When i translate it to delphi i recive AC. Re: I used this and it works (+) Thanks a lot, with your help I've finally solved this terrible problem:) it's horror to manipulate with special string characters (like eof, eoln) in C++.. Re: I used this and it works (+) useful idea but on my local compiler "feof (stdin)" always return 0, ever buf is clear, ever not Edited by author 27.12.2006 20:28 Re: I used this and it works (+) obviously, there must be !feof(stdin) |
|
|