This will certainly work.
Another solution is to use this control:
<http://www.nsbasic.com/ce/info/technotes/TN08.htm>
>Don't bother. the file control does not do what i want.
>the createfile and writefile however do.
>sample of my code:
>the functions for winsocket connect are missing but this is just to
>give a basic idea. For me it functions perfectly, ik can receive a zip
>file and save an exact copy of it.
>
>
>
>ShowOKButton True
>Const CREATE_ALWAYS = 2
>Const GENERIC_WRITE = &H40000000
>Const GENERIC_READ = &H80000000
>Const INVALID_HANDLE_VALUE= -1
>Declare "Function ReadFile Lib ""Coredll.dll"" ( ByVal hFile As Long,
>ByVal lpBuffer As String, ByVal nNumberOfBytesToRead As Long, byval
>lpNumberOfBytesRead As Long, ByVal lpOverlapped As Long) As Long"
>Declare "Function WriteFile Lib ""Coredll.dll"" Alias ""WriteFile"" (
>ByVal hFile As Long, Byval lpBuffer As String, ByVal
>nNumberOfBytesToWrite As Long, lpNumberOfBytesWritten As Long, ByVal
>lpOverlapped As Long) As Long"
>Declare "Function CloseHandle Lib ""Coredll.dll"" Alias
>""CloseHandle""( ByVal hObject As Long) As Long"
>Declare "Function CreateFile Lib ""Coredll.dll"" Alias ""CreateFileW""
>(ByVal lpFileName As string, ByVal dwDesiredAccess As Long, ByVal
>dwShareMode As Long,lpSecurityAttributes As Long, ByVal
>dwCreationDisposition As Long, ByVal dwFlagsAndAttributes As Long,
>ByVal hTemplateFile As Long) As Long"
>
>
>Dim recdata
>Sub winsock_DataArrival(ByVal bytesTotal)
> winsock.getData recdata, (vbBYTE+vbARRAY)
> For ict = 0 To bytesTotal-1
> recdata=d&ChrB(data(ict))
> Next
> savefile(recdata)
>End Sub
>Sub savefile(mystring)
> Fname="/my documents/test.zip"
> fHandle = CreateFile(Fname, GENERIC_WRITE, 0, 0, CREATE_ALWAYS, 0, 0)
> If fhandle <> INVALID_HANDLE_VALUE Then
> f=WriteFile (fhandle, MyString, LenB(MyString), lWritten, 0)
> Else
> MsgBox("no file created:"&fhandle)
> End If
> CloseHandle(fHandle)
>End Sub
>
>
>--- In [email protected], "paullussie13" <paullussi...@...>
>wrote:
>>
>> hello,
>>
>> i am having trouble saving a binary file i receive with winsock.(using
>> nsbasic 7.0)
>>
>> Somehow the received file is not thesame as the file transmitted.
>>
>> I tried saving data with file.put but this somehow adds a couple of
>> bytes at the beginning of the file.
>>
>> I also tried file.lineprint but this adds a crlf to the end of the file.
>>
>> data is received with winsock with the (vbBYTE+vbARRAY)
>> Also the data is comming to the pda correct, but i need a way to save
>> it as a file.
>> I cannot use an ftp server.
>>
>> Any help??
>>
>>
>> Regards Paul
>> i tried searching this group but to no avail.
>>
>
>
>
>------------------------------------
>
>Yahoo! Groups Links
>
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"nsb-ce" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nsb-ce?hl=en
-~----------~----~----~----~------~----~------~--~---