Finding Hex value in a formatted file

Hi

I am a newbie. I have a requirement to read format file and parse the records in the file. In the formatted file Delimeter is hex value ("1D").

I can open the file and read the record to string. I need help in finding this hex value in the read string.

Here is the record how it appears file:

SAA00 20 03 
SAD03 23 05 


Please help.

What do you mean by "finding its hex value"?
You can read up to the delimiter like this:
1
2
3
4
5
6
7
8
9
10
11
12
13
#include <fstream>
#include <string>

int main()
{
	std::ifstream ifs("input.txt");

	std::string record;
	while(std::getline(ifs, record, '\x1D'))
	{
		// record was read successfully
	}
}

Last edited on
You nailed it Galik.

Thank you Bunch .
Topic archived. No new replies allowed.