>I don't recall of a function in VFP to check for the validity of filenames.
>But maybe I overlooked it.
>Anybody now how to check the validity of a given filename.
>This comes in handy especially when users are specifying the name for export files.
>For example when they had a filename containing a "*".
There's a function in FOXTOOLS to do this, but it only works with 8.3 form names.
One quick way to check is to try to create the file using low-level I/O.
Function LegalName
LPARAMETER cNameToCheck
IF FILE(FULLPATH(cNameToCheck))
RETURN .t.
ELSE
LOCAL nFH
nFH=FCREATE(FULLPATH(cNameToCheck))
IF nFH = -1
RETURN .F.
ELSE
=FCLOSE(nFH)
ERASE (FULLPATH(cNameToCheck)
RETURN .T.
ENDIF
ENDIF
>Maybe a Win32 API call ?