Hello guys,
I have a binary file previously created and I am able to read it perfectly, the problem is that I would like after modying it, to save it again in the same place where it was.
here's the code I use to load it. as you can see in the comment if I try to use the the file.writebytes back to the same filename and dir I got from the ContentChooser I get an error.
Is there a simple way to accomplish this?
thanks
I have a binary file previously created and I am able to read it perfectly, the problem is that I would like after modying it, to save it again in the same place where it was.
here's the code I use to load it. as you can see in the comment if I try to use the the file.writebytes back to the same filename and dir I got from the ContentChooser I get an error.
Is there a simple way to accomplish this?
thanks
B4X:
Dim CC As ContentChooser, TempDir2,TempFileName2 As String, b() As Byte
CC.Initialize("CC")
TempDir2 = ""
TempFileName2 = ""
CC.Show("*/*", "Choose the binary file")
Wait For CC_Result (Success As Boolean, Dir2 As String, FileName2 As String)
If Success Then
TempDir2 = Dir2
TempFileName2 = FileName2
Else
ToastMessageShow("No files selected. File not imported", True)
Return
End If
b = File.ReadBytes(Dir2, FileName2)
'make some modification
'if I try to:
File.WriteBytes(Dir2,FileName2,b)
' I get a java.io.FileNotFoundException: ContentDir/content:/com.android.providers.downloads.documents/document/43: open failed: ENOENT (No such file or directory)