Hello to all,

First post in this concurred forum. I hope someone could help me.

I want to read a binary file using as line separator "ff77" in order to parse further each line one by one with some regex
since the file is big. I have a small ruby code shown below, but I'm new in C++, and I don't know how to replicate in C++
what this ruby code does.

Code:
#!/usr/bin/env ruby 

BEGIN{  $/="\xff\x77" } # Line separator = FF77

File.open(ARGV[0],"rb") # Open in binary mode

# Process each line one by one
while gets
    line = $_.unpack('H*')[0] #Storing the bytes for each line in "line "variable
    next unless line =~ /(..)(\d+)([A-B])/ # Regex with back-reference
    printf("%d %s %s\n",$1,$2,$3)  #Printing backreferenced patterns
end
I've been looking for a way to set the line delimeter and found getline function, but it seems getline only accepts one character
and I need 4 characters as line separator.

My attempt without success is below, it seems is not in that way.
Code:
#include <cstdlib>
#include <fstream>

int main() {
    std::ifstream input("C:\\binfile", ios::in | ios::binary);

    for( std::string line; getline( input, "ff77" ); )
{
    printf("%s",line);
}
    return 0;
}
Many thanks in advance for any help.