I'm very new to C.. so please be patient
I'm trying to read strings that were written to a file by a program written in Visual Basic... which means the strings are not null terminated.
so what I'm doing is reading the entire file as a single array as 'char ttl[512]' and then using individual loops to copy out the data as needed like this:
Code:
for (int i = 0; i < 20; i++) {
my_record.art2[i] = ttl[i+129];
}
my_record.art2[20]=0;
and then in the last line inserting the null terminator. the file says Artist 2 is a "string 20 characters long" (in BASIC terms) so I made the artist 2 as "char art2[21]" To allow for the null terminator.
Is this a valid way of making the strings null-terminated for c to handle? (then I'll reverse the process when I get ready to write the files)
edit: deleted the rest... I accidentally solved my problem... *shrug*