If the path is "C:\" the file is not created (Win 7 x64 Ultimate) but OpenFile() returns nonzero.
If FileSize() is called in the end, nonzero is returned but the file is nowhere. What do I do wrong?
I know that the OS is not giving me permission to write on "C:\" but why PB 5.30 is telling me that the file is writen successfully?
How can I find out if the file is really writen?
Code: Select all
Procedure SaveFile()
Pattern$ = "Text (*.txt)|*.txt|All files (*.*)|*.*"
Pattern = 0
File$ = SaveFileRequester("Please choose file name", "LAN Info", Pattern$, Pattern)
If File$
If ReadFile(0,File$);file already exists
CloseFile(0)
i=MessageRequester("Warning","File already exists. Overwrite ?",#PB_MessageRequester_YesNo)
If i= #PB_MessageRequester_No
ProcedureReturn
EndIf
EndIf
If GetExtensionPart(File$) = ""
File$ + ".txt"
EndIf
ii = OpenFile(#PB_Any,File$)
If ii
For i=0 To CountGadgetItems(0)
tmp$ = GetGadgetItemText(0,i,0)
If tmp$ = ""
WriteStringN(ii, "")
ElseIf FindString(tmp$,"Connection #") > 0
WriteStringN(ii,tmp$)
Else
WriteStringN(ii,LSet(tmp$,36," ") + " : " + GetGadgetItemText(0,i,1))
EndIf
Next
CloseFile(ii)
MessageRequester("","File created successfully.")
Else
MessageRequester("","Cannot create file.",#MB_ICONERROR)
EndIf
EndIf
EndProcedure


