[01 Jun 2009] manually adding extension to a file
Posted: Sat Jun 13, 2020 5:32 pm
Note: This is an archived post that was originally sent to the Hollywood mailing list on 01 Jun 2009 16:50:26 +0100
Hello, currently I am trying to maintain some fileextensions. When a requester returns I want to save a table to the given file. The file itself should be named in a special way, ending with ".hsmdb", but with the given code below I get an error in the OpenFile-line. To me it looks like the path derived from the requester gets changed in an illegal way in the subfunction "p_CheckAppendSuffix", but what am I doing wrong?
Regards GMKai
Hello, currently I am trying to maintain some fileextensions. When a requester returns I want to save a table to the given file. The file itself should be named in a special way, ending with ".hsmdb", but with the given code below I get an error in the OpenFile-line. To me it looks like the path derived from the requester gets changed in an illegal way in the subfunction "p_CheckAppendSuffix", but what am I doing wrong?
Regards GMKai
Code: Select all
Function p_SaveTab(f$)
f$=p_CheckAppendSuffix(f$)
OpenFile(1,f$,#MODE_WRITE)
Seek(1,0)
/*save tables To file*/
WriteTable(1,t_masterdata)
CloseFile(1)
EndFunction
Function p_CheckAppendSuffix(f$)
path=PathPart(f$)
file=FilePart(f$)
suffix=".hsmdb"
right=RightStr(file,6)
DebugPrint(right)
DebugPrint(suffix)
If (right<>suffix)
file=file..suffix
f$=FullPath(path,file)
EndIf()
Return f$
EndFunction