RE: [Dev-C++] possible bug of MinGW compiler
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Ioannis V. <no...@ya...> - 2001-10-22 11:37:18
|
> -----Original Message----- > From: Luigi Santillo [mailto:gi...@li...]=20 > Sent: Sunday, October 21, 2001 12:57 PM > To: Ioannis Vranos > Subject: RE: [Dev-C++] possible bug of MinGW compiler >=20 >=20 > Hi, >=20 > thanks again for your answer and excuse me if I my previous=20 > post was not so=20 > explicit, here I reformulate my question: >=20 > given the program "test.exe", the two commands > test < in.txt > test type on stdin the content of file "in.txt" > are equivalent (as I think) or not? Yes, with the exception that in the case of file redirection you get also an EOF at the end of file automatically, but you must enter it manually when you use stdin. > >If you want to be executed per input try using '\n' too. >=20 > What do you mean by: "executed per input"? Probably what you=20 > are suggesting=20 > is this: when I press "return" a newline is appended to the=20 > input and stdin=20 > is flushed, so the program "test.exe" counts what is on the=20 > line, it then=20 > pauses waiting for new input or for EOF (in which case it stops). I mean to look for '\n' too.=20 =20 > Well, if that is what you mean, then don't you think the=20 > problem will be=20 > there again when the input is made of one line with no '\n'? I do not completely understand what is the problem. The program behaves as you wrote it to do. When do you want it to stop automatically when you use keyboard? I assume when you press enter that's why the '\n' i told you. If you want, you can separate the file functioning of the keyboard functioning by providing the filename as an argument and using standard library I/O. You can even check argc and argv to see if you provided any argument with '<' and it to assume automatically that you have redirected input, so when it finds '<' to use EOF, when it doesn't find any '<' to use '\n'. =20 > >This is how it worked for me: > > > >C:\c>temp > >sdaff > >^Z > >n =3D 6 stdin > >C:\c> >=20 > Which compiler did you use? Since you did not specify, does=20 > that mean you used gcc version 2.95.2 19991024 (release)=20 > (i.e. same as mine)? C:\Dev-C++\Bin>gcc -v Using builtin specs. gcc version 2.95.2 19991024 (release) Ioannis * Ioannis Vranos * Programming pages: http://www.noicys.f2s.com * Alternative URL: http://run.to/noicys |