public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/54333] New: sprinf and fprintf work not always equal
@ 2012-08-20 20:32 lirex.software at gmail dot com
  2012-08-20 20:49 ` [Bug c++/54333] " pinskia at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: lirex.software at gmail dot com @ 2012-08-20 20:32 UTC (permalink / raw)
  To: gcc-bugs

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: unassigned@gcc.gnu.org
        ReportedBy: lirex.software@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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c++/54333] sprinf and fprintf work not always equal
  2012-08-20 20:32 [Bug c++/54333] New: sprinf and fprintf work not always equal lirex.software at gmail dot com
@ 2012-08-20 20:49 ` pinskia at gcc dot gnu.org
  2012-08-20 21:02 ` lirex.software at gmail dot com
  2012-08-21 10:28 ` redi at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2012-08-20 20:49 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54333

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-08-20 20:48:48 UTC ---
sprinf and fprintf  functions are not controlled by the compiler but rather the
System libc.  Report this bug to who you got the libc which GCC uses.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c++/54333] sprinf and fprintf work not always equal
  2012-08-20 20:32 [Bug c++/54333] New: sprinf and fprintf work not always equal lirex.software at gmail dot com
  2012-08-20 20:49 ` [Bug c++/54333] " pinskia at gcc dot gnu.org
@ 2012-08-20 21:02 ` lirex.software at gmail dot com
  2012-08-21 10:28 ` redi at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: lirex.software at gmail dot com @ 2012-08-20 21:02 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54333

--- Comment #2 from Denis Kolesnik <lirex.software at gmail dot com> 2012-08-20 21:01:54 UTC ---
thanks for the quick answer!


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c++/54333] sprinf and fprintf work not always equal
  2012-08-20 20:32 [Bug c++/54333] New: sprinf and fprintf work not always equal lirex.software at gmail dot com
  2012-08-20 20:49 ` [Bug c++/54333] " pinskia at gcc dot gnu.org
  2012-08-20 21:02 ` lirex.software at gmail dot com
@ 2012-08-21 10:28 ` redi at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: redi at gcc dot gnu.org @ 2012-08-21 10:28 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54333

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|enhancement                 |normal


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-08-21 10:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-20 20:32 [Bug c++/54333] New: sprinf and fprintf work not always equal lirex.software at gmail dot com
2012-08-20 20:49 ` [Bug c++/54333] " pinskia at gcc dot gnu.org
2012-08-20 21:02 ` lirex.software at gmail dot com
2012-08-21 10:28 ` redi at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).