PeterWieland
Registered User.
- Local time
- Today, 22:46
- Joined
- Sep 20, 2000
- Messages
- 74
Hi,
I need to read data from a text file produced by another application. It is in a fixed length, non-delimited format.
Reading the file with a Hex viewer, it has the following format:
1st 4 bytes - ID Number
2nd 21 Bytes - Forename
3rd 21 Bytes - Surname
etc up to 991 bytes, which is the length of the record.
Using the open and get commands, I can read the data into a string.
Dim varString As String * 991
Open "myfile.txt" For Random Access Read As #1 Len = 991
Get #1, 1, varString
Close #1
Now, my problem. I need to get the first 4 bytes into a numeric variable, then the names into string variables and ignore the rest.
If I use the Left function I get a mismatch error.
Any ideas?
Peter
I need to read data from a text file produced by another application. It is in a fixed length, non-delimited format.
Reading the file with a Hex viewer, it has the following format:
1st 4 bytes - ID Number
2nd 21 Bytes - Forename
3rd 21 Bytes - Surname
etc up to 991 bytes, which is the length of the record.
Using the open and get commands, I can read the data into a string.
Dim varString As String * 991
Open "myfile.txt" For Random Access Read As #1 Len = 991
Get #1, 1, varString
Close #1
Now, my problem. I need to get the first 4 bytes into a numeric variable, then the names into string variables and ignore the rest.
If I use the Left function I get a mismatch error.
Any ideas?
Peter