I have a text file in the format:
number tab word tab word tab junk
number tab word tab word tab junk
number tab word tab word tab junk
number tab word tab word tab junk
number tab word tab word tab junk
For each line I'd like to put the number in a uint32_t, then the two words into strings and then ignore the rest of the line. I could do this by loading the file into memory and then working through it a byte at a time, but I'm convinced that a lovely regex could do it for me. Any ideas?
I'm working in C++ using #include in Xcode - this is a commandline tool so there's no real output, I'm just storing the data to compare with other data.
c++andregexis this ac++11question or do you use some third-party library?file >> num >> word1 >> word2? Then you can either read the junk in and ignore it, or use.Ignore()...