[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]

File Size



Hi Ramesh,

RK> Will vi editor by default introduce newline character in
RK> the files created with the help of it.We have got the reply from Zameer
RK> Ahamed who told that the one extra byte is due to EOF character(0x0A) is
RK> it not EOL(End of line Character).

To test this, I created a file foo, and just typed in the characters
abc, and saved and exit via :wq

Then I wrote this lil proggy :
==========8<========================
#include <stdio.h>
main()
{
  FILE *fp;
  int i;

  fp = fopen("foo", "rb");

  while ((i=fgetc(fp))!=EOF)
   printf("\n%c %d", i, i);

  fclose(fp);
}
==========8<========================

If you execute this you'll see something like :

a 97
b 98
c 99

 10$
Where $ is the prompt. And there's your answer : vi inserts a linefeed
character at the end of the line.

hth
BGa


---
Send e-mail to 'ilugc-request@xxxxxxxxxxxxxxxxxx' with 'unsubscribe' 
in either the subject or the body to unsubscribe from this list.