Re: datainput stream

From: Amey Samant (ameyas7_at_yahoo.com)
Date: 12/11/03


Date: 10 Dec 2003 20:30:04 -0800

hi all
got all the mess sorted out finally
the readInt method though returns "int" is meant to read data written
by writeInt
it reads 4 bytes so if you enter 45
the int will be stored as ascii values of foloowing chars serailly
starting high order byte first
4
5
\n
\r

i also got the reason why their demo code failed
on windows platform when the input is entered it also reads \n & \r
whereas on *nix platform it reads only \n & not \r so i modified their
code to writeChar('\r) also & then it works fine
i should have read the DOCS with utmost care ;)
i was confused as i saw the return type as 'int'

cheers
amey



Relevant Pages

  • Re: K&R2 1.6 Arrays, exercise 1-13 (vertical histogram)
    ... | int main ... I thought you always initialised variables on declaration, ... This, of course, could have been done by initialising on declaration ... (If the latter reason is true, learning it would have done no good here, because Reason 1 would still have applied.) ...
    (comp.lang.c)
  • Re: newbie (dropping numbers) new post
    ... Either use a #define or a constant int here. ... Please note that the above loop is only an example. ... entry error was detected on stdin. ... Reason number 2 for the array idea for scores. ...
    (alt.comp.lang.learn.c-cpp)
  • Re: Boost process and C
    ... of int for sizes, rather than size_t. ... read-only and constant strings and detecting errors efficiently ... I do have good reason for doing this. ... If the DOS port hadn't been dropped then depending on the compiler we ...
    (comp.lang.c)
  • Re: what is wrong?
    ... The only reason you "should" get no output is if the int 21h/47h fails. ... After the "xlatb", ...
    (alt.lang.asm)
  • Re: clearing low order bits / making a multiple of power of 2
    ... > The other reason has to do with correctness. ... > The reason is that, on a platform where 'int' is 64 bits, ... > 'unsigned int' operands. ... > and developers who are careful concern themselves with such ...
    (comp.lang.c)