| xHarbour Reference Documentation > Function Reference |
![]() |
![]() |
![]() |
Writes a string to a file starting at a specified position.
StrFile( <cString> , ;
<cFileName> , ;
[<lUseExisting>], ;
[<nOffset>] , ;
[<lTruncate>] ) --> nBytesWritten
The function returns the number of bytes written to the file as a numeric value.
| See also: | CSetSafety(), FileStr(), FWrite() |
| Category: | CT:DiskUtil , File functions , Low level file functions |
| Source: | ct\strfile.c |
| LIB: | xhb.lib |
| DLL: | xhbdll.dll |
// The example writes the names of all PRG files of the current directory
// to a file.
PROCEDURE Main
LOCAL cFileName := "Prg_files.txt"
LOCAL aFiles := Directory( "*.prg" )
LOCAL aFile
FOR EACH aFile In aFiles
StrFile( aFile[1] + HB_OsNewLine(), ;
cFileName, .T. )
NEXT
RETURN
http://www.xHarbour.com