Re: Missing EOF

From: Andreas Kahari (ak+usenet_at_freeshell.org)
Date: 09/17/03


Date: Wed, 17 Sep 2003 21:42:44 +0000 (UTC)

In article <bkaipn$a7j$1@ulysses.noc.ntua.gr>, Kornilios Kourtis wrote:
> Vaslav <vaslav@globlar.cz> wrote:
>> Some files I must process have a EOF and some files don't. I know I can
>> add one with echo "" >> file. The problem is that I can't use files with
>> 2 EOF. Should I use tr ? How?
>>
>
> AFAIK files don't really contain an EOF at their end. It's just a symbol
> used in programming to allow the programmer to know that a file
> ended.

I believe he's really asking for a way of adding a final newline
if the last line in the file doesn't end with one.

However, a file with a line not ending with a newline is
strictly speaking not a text file. Unix utilties for
manipulating text files are generally bad att coping with
non-text files.

Some editors (vi/vim and Emacs) can be made to add a final
newline to files when saving them if one wasn't present before.
If this feature may be used in an automatic fashion (maybe by
scripting ex/vi), I don't know.

-- 
Andreas Kähäri


Relevant Pages

  • Re: Missing EOF
    ... Vaslav wrote: ... AFAIK files don't really contain an EOF at their end. ... used in programming to allow the programmer to know that a file ...
    (comp.unix.shell)
  • Re: EOF & Learning C
    ... >> Programming Language' (Second Edition). ... >> enter key just makes a newline and dosen't terminate the application ... What exactly is the function of EOF? ... sure all output lines end with a newline. ...
    (alt.comp.lang.learn.c-cpp)
  • Re: Article about HLA on Linux Journals website
    ... HLA is an assembly language, although one might be able to write a few ... > this is batch programming and not assembly programming. ... > goto:eof ...
    (alt.lang.asm)
  • Re: beginner c questions
    ... > I actually have Kernighan and Ritchie, "The C Programming Language" ... EOF is explained on ... > dont know where to go next, I do have php programming experence but am ...
    (comp.lang.c)
  • Re: Some suggestion required regarding get line functionality.
    ... char *temp_buff; ... position of pos ... but we need to put newline at the end od buf;So ... Why return NULL if you hit EOF? ...
    (comp.lang.c)