|
From: <or...@vp...> - 2002-11-20 14:57:30
|
Hello Paul!
> #include <stdio.h>
>
> int main(void)
> {
> int nc;
> for(nc=0;getchar()!=EOF;nc++)
> ;
> printf("\n"); /* On Linux this is NOT needed */
> printf("%d\n",nc);
>
> return 0;
> }
Paul wrote:
> Also can you give me a solution for the counting characters program?
> I tried the following but it seems that the printf statement is not
> executed.
Well, I examined your problem further. On my Linux (Debian) YOUR code
works fine (no need for the first '\n').
NOTE that on Linux AND in DevCpp the SAME compiler (gcc) is used, with
the same standard library (just different implementation).
So the problem is with Microslut's Windblows' console stdin/stdout
handling. It is not a suprise that things don't work on Windblows as
you would expect.
--
Best regards,
Oroszi Balázs mailto:or...@vp...
PGP-FP: FB80 8A43 2664 6126 E465 46E2 2546 CFA3 C25B 9F70
finger -l or...@se...
|