| xHarbour Reference Documentation > Function Reference |
![]() |
![]() |
![]() |
Tests if a string contains a valid file name.
FileValid( <cFileName> , ;
[<nMaxName>] , ;
[<nMaxExtension>], ;
[<lNoExtension>] , ;
[<lSpaces>] ) --> lIsValid
The function returns .T. (true) if <cFileName> contains a valid filename, otherwise .F. (false) is returned.
| See also: | HB_FNameSplit(), Token(), TrueName() |
| Category: | CT:DiskUtil , File functions , Low level file functions |
| Source: | ct\diskutil.prg |
| LIB: | xhb.lib |
| DLL: | xhbdll.dll |
// The example implements the function LongFileValid() which tests
// if a long file name is valid
PROCEDURE Main
? FileValid( "MyApp.prg" ) // result: .T.
? FileValid( "My New Application.prg" ) // result: .F.
? LongFileValid( "My New Application.prg" ) // result: .T.
RETURN
FUNCTION LongFileValid( cFileName, lExtension )
IF Valtype( lExtension ) <> "L"
lExtension := .F.
ENDIF
RETURN FileValid( cFileName, 255, 255, lExtension, .T. )
http://www.xHarbour.com