Welcome to HBH! If you have tried to register and didn't get a verification email, please using the following link to resend the verification email.

strange size


ghost's Avatar
0 0

this is my 4 programme in file handling and i can't undestand why the size of file differ in differ enviroment…

#include<stdio.h> #include<conio.h>

main(int argc,char *argv[]) { FILE *fp; int ch; int num=0;

clrscr();

fp=fopen(argv[1],"r");

while((ch = fgetc(fp)) !=EOF) num++; printf("Number of chars in file %d",num);

}


priya pri samuel

i typed 13 chars the output shows 16 chars ..and wheni goto DOS it shows 19 chars..

can anybody hlp me


ghost's Avatar
0 0

U Typed 13 Chars Fine..But U Forgot To Count The Enter Key Presses 3 Times For Newline. i.e, 13+3=16 Chars

For Dos Enter Key Is A COmbination Of Newline And Carriage Return Character… i.e, 13+3+3=19 Chars