Remove a line from a text file

Remove first or last line in a text file.

Usage : Rem1Line( <cInFName>, <nLocat> )

Where :

<cInFName> : Name of tex file to proceed.
<nLocat> : Location; 1: First line 2: Last line

Resulting is a separate file.

Warning : first / last line may be empty.

You may call Rem1Line() function anywhere your programs.

For write output file to over source file :

– discard

IF "." $ cInFName
    cOutFNam := LEFT( cInFName, AT( ".", cInFName ) - 1 ) +; 
                     HB_NTOS( nLocat ) +; 
                     SUBSTR( cInFName, AT( ".", cInFName ) )
ELSE 
    cOutFNam := cInFName + HB_NTOS( nLocat )
ENDIF

IF block and add : cOutFNam := cInFName

or simply change:

HB_MEMOWRIT( cOutFNam, cText )

line to

HB_MEMOWRIT( cInFName , cText )

August 2012
Download source file.