http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54333
Bug #: 54333 Summary: sprinf and fprintf work not always equal Classification: Unclassified Product: gcc Version: 4.6.1 Status: UNCONFIRMED Severity: enhancement Priority: P3 Component: c++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: lirex.softw...@gmail.com Created attachment 28059 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=28059 the c++ source file in the following part of the code: profit_tax_stream = fopen ("test_write.txt","w"); profit_tax_stream2 = fopen ("test2.txt","r"); //fputc(c, profit_tax_stream[0]); fprintf(profit_tax_stream, "testtest\" test 123"); strcpy(chBuffer,"\0"); //strcat(chBuffer," adsadasda"); fscanf(profit_tax_stream2,"%s", chBuffer); fprintf(profit_tax_stream,"%s", chBuffer); //fscanf(profit_tax_stream2, chBuffer); //fprintf(profit_tax_stream, chBuffer); //fprintf(profit_tax_stream[0], "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>"); fclose(profit_tax_stream); fclose(profit_tax_stream2); fscanf reads a portion of data delimited by space, but only when I use fscanf(profit_tax_stream2,"%s", chBuffer); but it reads nothing at all(I see nothing added to the file opened for write and also I tried to output the content of chBuffer via Messagebox) when I use fscanf(profit_tax_stream2, chBuffer); line of code instead. The problem is, that the "opposite" function fprintf works in both cases. ---- My operation system is Windows XP HOME Edition OEM Service Pack 3 ---- My compile line: c++ -I"D:\Program Files\PostgreSQL\9.1\include" -L"D:\Program Files\PostgreSQL\9.1\lib" -lpq -o %application_file% %application_file%.cpp -Wl,--subsystem,windows -lgdi32 -lcomctl32 -D_WIN32_IE=0x0300 -save-temps