Tayfur Well-Known Member Licensed User Longtime User Feb 14, 2014 #1 Hello I have "TRESIM.DAT" files. And it has a 10byte data. (data="TC}Ñ╩12#╣A" ) After, I want to add 5byte data. (bytes =ASDFGH) (new file "TRESIM.DAT" = data+bytes = "TC}Ñ╩12#╣AASDFGH") and save this file . But I cant it. How can it Code: Copy Dim raf As RandomAccessFile raf.Initialize(File.DirRootExternal, "TRESIM.dat", False) s=raf.Size '*** bytes=ASDFGH raf.WriteBytes(bytes,0,bytes.Length-1,raf.CurrentPosition) raf.Close
Hello I have "TRESIM.DAT" files. And it has a 10byte data. (data="TC}Ñ╩12#╣A" ) After, I want to add 5byte data. (bytes =ASDFGH) (new file "TRESIM.DAT" = data+bytes = "TC}Ñ╩12#╣AASDFGH") and save this file . But I cant it. How can it Code: Copy Dim raf As RandomAccessFile raf.Initialize(File.DirRootExternal, "TRESIM.dat", False) s=raf.Size '*** bytes=ASDFGH raf.WriteBytes(bytes,0,bytes.Length-1,raf.CurrentPosition) raf.Close
stevel05 Expert Licensed User Longtime User Feb 14, 2014 #2 Try setting the current position Code: Copy raf.CurrentPosition = raf.size -1 before writing Upvote 0
Tayfur Well-Known Member Licensed User Longtime User Feb 15, 2014 #3 stevel05 said: Try setting the current position Code: Copy raf.CurrentPosition = raf.size -1 before writing Click to expand... thank you for helps. Upvote 0
stevel05 said: Try setting the current position Code: Copy raf.CurrentPosition = raf.size -1 before writing Click to expand... thank you for helps.
Erel B4X founder Staff member Licensed User Longtime User Feb 16, 2014 #4 It should be: Code: Copy raf.CurrentPosition = raf.Size Upvote 0
Tayfur Well-Known Member Licensed User Longtime User Feb 17, 2014 #5 Erel said: It should be: Code: Copy raf.CurrentPosition = raf.Size Click to expand... thank you Erel; its works. I use AsyncStreams. And file transfer (2-4 mb) from PC to Phone. My way is. PC: 1-Convert byte data >> hex data 2-Send to phone (max length =1024) Phone 1- Recive data 2- convert hex to byte 3- write+add in file Only problem AsyncStreams cant recive byte data. I send to pfoen from byte data (for examplae 600byte). Phone recive (415byte) . bytheway I convert to byte to hex, and after send it. How can recive byte data? Upvote 0
Erel said: It should be: Code: Copy raf.CurrentPosition = raf.Size Click to expand... thank you Erel; its works. I use AsyncStreams. And file transfer (2-4 mb) from PC to Phone. My way is. PC: 1-Convert byte data >> hex data 2-Send to phone (max length =1024) Phone 1- Recive data 2- convert hex to byte 3- write+add in file Only problem AsyncStreams cant recive byte data. I send to pfoen from byte data (for examplae 600byte). Phone recive (415byte) . bytheway I convert to byte to hex, and after send it. How can recive byte data?
Erel B4X founder Staff member Licensed User Longtime User Feb 17, 2014 #6 Not sure what you mean. AsyncStreams only works with arrays of bytes. Upvote 0