
I hope u can help me

I want to open a BINARY file and read the data into blocks as STRING (size 1022) ... *later it should be used in a TCP Filetransfer)
The problem is PeekS seem to ignore special characters it only returns "MZ" with a textfile *.TXT all is working well :/
Please give me a hint or a solution how to Read a binary file into blocks as a STRING

This is my current code:
Code: Select all
If ReadFile(0,"D:\TEST.exe")
While Eof(0) = 0
*sendID = AllocateMemory(1022)
ReadData(0,*sendID, 1022)
stack.s = "S#" + PeekS(*sendID,1022)
Debug stack.s
FreeMemory(*sendID);CLEAN UP MEMORY
Wend
CloseFile(0)
Debug "EOF"
Else
;ERROR
EndIf
Code: Select all
Dim mystring as String
Open "FILEPATH" For Binary Access Read As #1
mystring = Input(LOF(1), 1)
Close #1
msgbox mystring ,, ""
Thx datachild
sorry about my bad english
