Mail Archives: djgpp/2009/08/22/19:15:21
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 -