format of strings

hackhack

Active Member
Licensed User
Longtime User
Can a string hold characters from 0 to 255 ascii?

When the http library talks about reading things into 'strings' does that include binary files?
 

hackhack

Active Member
Licensed User
Longtime User
Aww, the old days are really gone, eh.

Ok 2 questions:

How do i write them to a file then? Seems there is only file.WriteString not WriteBinary

And, byte arrays can't be open ended right? You have to dim their size in advance of using them?
 
Upvote 0

hackhack

Active Member
Licensed User
Longtime User
You can use OutputStream or RandomAccessFile to write the data. What are you trying to do, maybe their is a simple way to do it?

I'm trying to download an apk from a website, and once downloaded start the install to allow the user to update the app.

I tried just launching the browser to the URL, and that sorta works, the apk gets downloaded, but I'm not sure if the download would always be in the same place. I can't be sure of the name necessarily, and I don't know how the app would know when the browser had finished. So I thought I should try and download it myself (so to speak)
 
Upvote 0

hackhack

Active Member
Licensed User
Longtime User
This should not be too difficult.
You are using HttpUtils, right?

Yes, I saw you said that was the easy way :)

To copy a file you should use code similar to:
B4X:
Dim out As OutputStream
out = File.OpenOutput(File.DirRootExternal, "1.apk", false)
File.Copy2(HttpUtils.GetInputStream(...), out)
out.Close

Thanks, I'll try that.
 
Upvote 0
Top