-
Array manipulation
I have a byte array with a filename+filedelimiter+filedata in it.
once i get the filename, i want to drop it and the delimiter and write out
the file data to a file. i have to loop thru the array to do this now.
i write,
for 1=filedatastartposition to endoffileposition
put #1,bytearray(i)
next
can anyone tell me how i can speed this up since its really slow for large
files. ??
the files could be text, images..anything posted over the web
-
Re: Array manipulation
Here's another approach which may or may not be better:
lFilePosition = len(sFileName) + len(sFileDelimiter)
Put #lFileNumber, Mid$(ayByteArray, lFilePosition)
Here's the logic behind this code snippet:
Arrays can be converted to strings and back. Each character in the string
holds two bytes. Assuming that the File Delimiter is a string character
you can calculate the starting character of the data. You then use the Mid$
function to extract the rest of the file. I don't know if this will work
for your situation or not. If it does work I don't know if it will be faster.
There's only one way to find out, though.
--Kenny
"Sai" <sramani@lumedx.com> wrote:
>
>I have a byte array with a filename+filedelimiter+filedata in it.
>once i get the filename, i want to drop it and the delimiter and write out
>the file data to a file. i have to loop thru the array to do this now.
>
>i write,
>
>for 1=filedatastartposition to endoffileposition
>put #1,bytearray(i)
>next
>
>can anyone tell me how i can speed this up since its really slow for large
>files. ??
>
>the files could be text, images..anything posted over the web
>
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks