This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Problems with fgetc on Linux - Is this a Bug?


I could use a little help.

I'm converting software which was developed on DEC Ultrix to run on
Linux.  It works great on Ultrix, and I'm not sure if I've found a bug
in Linux or not.


The code fragment looks like this:

    while ( n < len ) {

        if (( ch = fgetc( FD ) ) == EOF ) {
            if ( n>1)
                return( n );
            else
                return( EOF );
            }
        line[n++] = ch;
        }

This fragment works great on Ultrix, on Linux ;-(  On Linux, I get 12
bytes of data.  So I checked the information in the file, and came up
with the following output from `od`.


[root@Elvis newtolls]# od -N 750 -t x 289.122
0000000 01000015 00c100fe f0000001 0004caff
0000020 80000000 ffffffff ffffffff ffffffff
0000040 ffffffff ffffffff ffffffff ffffffff
*
0001000 fff00000 00070002 00000000 45000000
0001020 00aa0000 4c833c83 00004c04 4c040c00
0001040 0c000000 007c2000 0000000c 0c000000
0001060 00007c00 00000000 3c616235 4c032715
0001100 12100000 000c000c 0c000000 1c001c00
0001120 007c2001 aa00003c 001c0000 004c046c
0001140 040c0000 0000004c 7c20000c 000c0000
0001160 0c0c0000 0c000c0c 62354c72 001c2c48
0001200 75584c72 35156c61 00009c20 001c0102
0001220 aa000047 001c0040 004c046c 040c0000
0001240 0000004c 7c20000c 000c0000 1c0c0000
0001260 0c000c0c 64354c72 001c5c44 11564c72
0001300 37155c83 00000c12 020c0000 7c20005c
0001320 0c293715 3c000c00 00aa0000 6c001c00
0001340 00004c04 4c040c00 0c000000 00002000
0001356


Any suggestions?



-- 
Albert E. Whale       aewhale@hky.com
http://www.hky.com/aewhale.html
------------------------------------------------------------------
Sr. Database, Internet and Unix Systems Consultant

Pennsylvania Parenthood Initiative - PAPI
http://www.geocities.com/Heartland/4688/papi.htm
The Father's Rights Network - http://www.hky.com/frn/frnhome.html
Parents without Partners - Past President
Co-Founder of The Purple Heart Foundation

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]