|
-
Jul 30th, 2002, 11:59 PM
#1
Thread Starter
Hyperactive Member
Find location of string in a file
I opened a file like this:
//open file in binary read mode
ifstream file (Filepath, ios::in|ios::binary);
I need to open in in binary mode to be able to read all bytes (including null chars)
My question is. How do you find the location of a string in a file? Similar to instr in VB. I am reading an MP3 file. They have ascii tags embedded through out the file (there are null chars between the tags). If I try to put the tag from the MP3 into a *char, it will truncate after the first null char.
example: I need to find the location of "TRCK" in the file, then the next few bytes (when math is applied) will tell me how long the track tag is (in bytes). Once I know how long the tag is, I can grab it. The problem is finding where "TRCK" is.
I hope I am not being unclear.......hard to explain.
thanks
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
|
Click Here to Expand Forum to Full Width
|