www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2009/08/22/19:15:21

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
From: "bpascal123 AT googlemail DOT com" <bpascal123 AT googlemail DOT com>
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 16:12:30 -0700 (PDT)
Organization: http://groups.google.com
Lines: 141
Message-ID: <a515e503-2aff-48ef-8721-07a9c06e70b4@t13g2000yqt.googlegroups.com>
References: <0e105b0f-b8ec-4c77-8b84-20761536eefa AT k30g2000yqf DOT googlegroups DOT com>
<h6pdqq$co2$1 AT aioe DOT org>
NNTP-Posting-Host: 82.247.153.85
Mime-Version: 1.0
X-Trace: posting.google.com 1250982751 14781 127.0.0.1 (22 Aug 2009 23:12:31 GMT)
X-Complaints-To: groups-abuse AT google DOT com
NNTP-Posting-Date: Sat, 22 Aug 2009 23:12:31 +0000 (UTC)
Complaints-To: groups-abuse AT google DOT com
Injection-Info: t13g2000yqt.googlegroups.com; posting-host=82.247.153.85;
posting-account=qke9lAkAAAC0GKPOVdICgk-QxjHzvSsI
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.2)
Gecko/20090729 Firefox/3.5.2 (.NET CLR 3.5.30729),gzip(gfe),gzip(gfe)
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

On Aug 22, 8:36=A0pm, "Rod Pemberton" <do_not_h DOT  DOT  DOT  AT nohavenot DOT cmm> wrote:
> <bpascal DOT  DOT  DOT  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/40d8c...
>
>
>
>
>
> > But to resume it, it's about getchar. When I want to compile the code
> > below i get =A0:
> > from (null):4294967295
>
> >http://c-faq.com/~scs/cclass/notes/sx6b.html
>
> > #include <stdio.h>
>
> > /* copy input to output */
>
> > main()
> > {
> > =A0 =A0 =A0 =A0 int c;
>
> > =A0 =A0 =A0 =A0 c =3D getchar();
>
> > =A0 =A0 =A0 =A0 while(c !=3D EOF)
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 {
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 putchar(c);
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 c =3D getchar();
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 }
>
> > =A0 =A0 =A0 =A0 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 =A0from (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 =A0You've said you're using gcc fo=
r
> both Linux and Windows. =A0Which gcc based compiler are you using for Win=
dows?
> DJGPP? Cygwin? Mingw? =A0And, which version?
>
> If DJGPP, then you've posted to the correct group. =A0DJGPP (which is gcc
> based) v2.03 and v2.04 compiles the above code without the specified erro=
r.
> The reason he asked about compile time is that _seems_ more like a runtim=
e
> error than a compile time error. =A0I.e., bad input to getchar might caus=
e
> such an error, but it seems unlikely the compiler would generate the erro=
r.
>
> Maybe someone else has an inkling. =A0The only other thing I can suggest =
at
> the moment is to try a different text editor and retype the code from
> scratch. =A0Don't cut-n-paste. =A0Very rarely, an unusual character in th=
e text,
> e.g., from the cut-n-paste from the webpage, will cause problems for
> compilers. =A0Rarely, certain text editors have problems too. =A0There ar=
e some
> editors that will insert "bad" characters, insert nul's, or corrupt the
> end-of-line marker. =A0If you're using a Windows editor, check to see if =
there
> is a "save-as" option. =A0You might be able to save in different text onl=
y
> formats.
>
> Rod Pemberton

Hi,

Which gcc based compiler are you using for Windows?
> DJGPP? Cygwin? Mingw?  And, which version?
->DJGPP

And, which version?
I don't know how to check this, i have this path : C:\DJGPP\gnu
\gcc-4.32 , i don't know if this can tell the version of DJGPP by
chance.

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.

I just did. I retyped it with Windows text editor notepad and compiled
it and the output :

from (null):42929672795,   ...in a loop
SIGINT
INTR key Pressed at eip=3D00698e2a
'
 Exiting due to signal SIGINT
INTR key Pressed at eip=3D00034a96


Someone in the c discussion said :

For what it's worth, 4294967295 is another way of expressing the value
0xFFFFFFFF. That's a very suspicious number.

I have to say that earlier on the day this occured  i rearranged
folder in the djgpp folder BUT I just rearranged folders i had created
where i had saved tutorial codes since i installed djgpp (3-4 months
ago). However, i haven't been compiling all the time with djgpp in
Windows but also in gcc Linux so it's difficult for me to say if code
with getchar was or was not working before i "re-arranged" folders
with code files (very simple code, i didn't get yet to pointers...).

I'm waiting for any advice. I hope i don't have to reinstall djgpp.

Thanks,

Pascal

- Raw text -


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