I put some bytes to file. Then I open this file in HexEditor and discover that data in the file differs from data I have put.
And when I insert these data to string (at bottomost of the code) I get different length of data.
Code: Select all
sors$=Chr(48)+Chr(48)+Chr(31)+Chr(48)+Chr(48)+Chr(48)+Chr(48)+Chr(31)+Chr(78)+Chr(65)+Chr(77)+Chr(198)+Chr(143)+Chr(76)+Chr(85)+Chr(77)+Chr(31)+Chr(78)+Chr(65)+Chr(77)+Chr(198)+Chr(143)+Chr(76)+Chr(85)+Chr(77)+Chr(31)+Chr(78)+Chr(65)+Chr(77)+Chr(198)+Chr(143)+Chr(76)+Chr(85)+Chr(77)+Chr(31)+Chr(78)+Chr(65)+Chr(77)+Chr(198)+Chr(143)+Chr(76)+Chr(85)+Chr(77)+Chr(31)+Chr(48)+Chr(48)+Chr(31)+Chr(48)+Chr(48)+Chr(48)+Chr(48)+Chr(48)
sorslen=StringByteLength(sors$,#PB_UTF8)
Debug sorslen
raytSessn=CreateFile(#PB_Any,"c:\temp\samfayl.dat",#PB_File_NoBuffering)
If raytSessn
*wMem=AllocateMemory(sorslen*1.1)
If *wMem
pokBaytz=PokeS(*wMem,sors$,sorslen,#PB_UTF8)
ritnBaytz=WriteData(raytSessn,*wMem,pokBaytz)
FreeMemory(*wMem)
EndIf
CloseFile(raytSessn)
EndIf
faylen=FileSize("c:\temp\samfayl.dat")
ridSessn=ReadFile(#PB_Any,"c:\temp\samfayl.dat",#PB_File_NoBuffering)
If ridSessn
*rMem=AllocateMemory(faylen*1.1)
If *rMem
ridBaytz=ReadData(ridSessn,*rMem,faylen)
If ridBaytz
dest$=PeekS(*rMem,ridBaytz,#PB_UTF8)
destlen=StringByteLength(dest$,#PB_UTF8)
Debug destlen
EndIf
FreeMemory(*rMem)
EndIf
CloseFile(ridSessn)
EndIf
txtVal$=[CopieDataFrom'c:\temp\samfayl.dat']
txtVaLen=StringByteLength(txtVal$,#PB_UTF8)
Debug txtVaLen