Hello,
I've recently started to program my own file structure in visual basic 6 and I found out the way to do this of course is binary files. However, my problem is, I don't know anything lol! I know the basics of reading and writing binary files. I came up with a method of pulling records with a comma seperation but it isn't near efficiant because everytime I go read a record, I get 100% CPU usage and that isn't exactly what I want my software to do. Especially when reading multiple records in. Long story short, why does this cause 100% cpu usage and what is a better way to manipulate binary files? The bigger the file, the worse it is...
I tried this too
I know these processes are going through the entire file, however my question is, how do you know where a record starts and ends without something like
If binaryin = <ascii code for comma or something> Then
Record = Record + 1
End If
I know I'm probably going about this whole thing wrong, I suck. I hope someone can shed some light on this in layman's terms.
I've recently started to program my own file structure in visual basic 6 and I found out the way to do this of course is binary files. However, my problem is, I don't know anything lol! I know the basics of reading and writing binary files. I came up with a method of pulling records with a comma seperation but it isn't near efficiant because everytime I go read a record, I get 100% CPU usage and that isn't exactly what I want my software to do. Especially when reading multiple records in. Long story short, why does this cause 100% cpu usage and what is a better way to manipulate binary files? The bigger the file, the worse it is...
Code:
Dim getloop As Long
Dim binaryin As Byte
getloop = 1
Open "c:\test\test.alr" For Binary As 1
While Not EOF(1)
Get #1, getloop, binaryin
getloop = getloop + 1
Wend
Close 1
Code:
For getloop = 1 to FileLen("c:\test\test.alr")
Get #1, getloop, binaryin
Next getloop
If binaryin = <ascii code for comma or something> Then
Record = Record + 1
End If
I know I'm probably going about this whole thing wrong, I suck. I hope someone can shed some light on this in layman's terms.
Comment