delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2009/08/22/14:45:18

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
From: "Rod Pemberton" <do_not_have AT nohavenot DOT cmm>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Compile a simple C code with getchar and i get : from (null):4294967295
Date: Sat, 22 Aug 2009 14:36:19 -0400
Organization: Aioe.org NNTP Server
Lines: 84
Message-ID: <h6pdqq$co2$1@aioe.org>
References: <0e105b0f-b8ec-4c77-8b84-20761536eefa AT k30g2000yqf DOT googlegroups DOT com>
NNTP-Posting-Host: pldq+kT97bAAp/ObDwnZyQ.user.aioe.org
X-Complaints-To: abuse AT aioe DOT org
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1933
X-Notice: Filtered by postfilter v. 0.7.9
X-Newsreader: Microsoft Outlook Express 6.00.2800.1933
Cancel-Lock: sha1:ggdguAFspD2PV2JIsANaEXERAbk=
X-Priority: 3
X-MSMail-Priority: Normal
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

<bpascal123 AT googlemail DOT com> wrote in message
news:0e105b0f-b8ec-4c77-8b84-20761536eefa AT k30g2000yqf DOT googlegroups DOT com...
> Hi,
>
> I have started learning how to programm 3-4 months ago with little to
> non-experience in computer litterature and languages...
>
> My question is also active in :
>
>
http://groups.google.com/group/comp.lang.c/browse_thread/thread/40d8cf931084b9de/39eb474e02108c5b#39eb474e02108c5b
>
> But to resume it, it's about getchar. When I want to compile the code
> below i get  :
> from (null):4294967295
>
> http://c-faq.com/~scs/cclass/notes/sx6b.html
>
> #include <stdio.h>
>
> /* copy input to output */
>
> main()
> {
>         int c;
>
>         c = getchar();
>
>         while(c != EOF)
>                 {
>                 putchar(c);
>                 c = getchar();
>                 }
>
>         return 0;
>
> }
>
> As i'm learning to program, i compile both in linux and windows. So i
> decided to check if other files i though were working on both
> plateforms would work but it seems all files with a simple getchar()
> function don't work in windows (i get  from (null):4294967295) but do
> work in linux (i don't know how i didn't notice it).
> And it seems all file with a simple call to getchar and another call
> to wipe '\n' out work in windows and linux as well.
>
> Someone in the c.comp.lang discussion is saying :
>
> Are you really saying that you get the above message *at compile
> time*? (me: yes : gcc myfile.c -o myfile.exe)
>
> And you see that message when you compile the exact code that you
> posted earlier, but not when you compile other C programs? (me:very
> strange, but yes!)
>
> If so, you have a serious problem with your compiler.
>
> (me : what problem??? Should i reinstall ? )
>

There are many messages on comp.lang.c  You've said you're using gcc for
both Linux and Windows.  Which gcc based compiler are you using for Windows?
DJGPP? Cygwin? Mingw?  And, which version?

If DJGPP, then you've posted to the correct group.  DJGPP (which is gcc
based) v2.03 and v2.04 compiles the above code without the specified error.
The reason he asked about compile time is that _seems_ more like a runtime
error than a compile time error.  I.e., bad input to getchar might cause
such an error, but it seems unlikely the compiler would generate the error.

Maybe someone else has an inkling.  The only other thing I can suggest at
the moment is to try a different text editor and retype the code from
scratch.  Don't cut-n-paste.  Very rarely, an unusual character in the text,
e.g., from the cut-n-paste from the webpage, will cause problems for
compilers.  Rarely, certain text editors have problems too.  There are some
editors that will insert "bad" characters, insert nul's, or corrupt the
end-of-line marker.  If you're using a Windows editor, check to see if there
is a "save-as" option.  You might be able to save in different text only
formats.


Rod Pemberton


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019