Link to home
Start Free TrialLog in
Avatar of ITKnightMare
ITKnightMare

asked on

(URGENT) Which way of saving a string to file is faster?



filenum = FreeFile

Open "C:\bleeh.jpg" For Output As #filenum
   Print #filenum, Myjpegcontentsasstring
Close #filenum
End If


OR

The textstream object with the FileSystemObject in scripting.runtime?

Also if someone would give me the code for TextSteam way of doing it I would appreciate it.  If indeed that's faster of course.

OR

Perhaps some other way to save a string into file in VB6 that is faster than all the other ways?


It's URGENT so 500 points is well deserved for the fastest correct answer :)
SOLUTION
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ITKnightMare
ITKnightMare

ASKER

But then how come when I do it the

filenum = FreeFile

Open "C:\bleeh.jpg" For Output As #filenum
   Print #filenum, Myjpegcontentsasstring
Close #filenum
End If

way for around 40 different strings to be saved, it eats up like 100% of the CPU and takes a noticably slow time?

Are we sure there isn't a faster way of saving a string content to file?  Perhaps an API call which always end up being faster?
I think you didn't show us the whole code.
for i = 0 to 39

filenum = FreeFile

Open "C:\bleeh" & i & ".jpg" For Output As #filenum
   Print #filenum, Myjpegcontentsasstring(i)
Close #filenum
End If
next i
Well I ended up using the output way, thanks for trying anway.