I have a file containing A heading followed by the encrypted data. I need to ignore the 1st line (heading ) and read the rest of the file and then decrypt. I am doing this in C++. How do i go about it. I have tried getLine, but doesnt seem to work
Asked
Active
Viewed 126 times
0
-
3Expand on "doesn't seem to work". Where is your [mcve]? – Asteroids With Wings Jan 05 '21 at 02:59
-
4How do you define "line" in a binary file? How is the heading terminated? What sequence of bytes signifies this? – Asteroids With Wings Jan 05 '21 at 03:00
-
4In a binary file, there is no concept of a "line". `'\n'` is nothing but byte `0xa` as far as a binary file is concerned. – David C. Rankin Jan 05 '21 at 03:11
-
1If the 1st line is terminated by a single byte delimiter, you can use [`std::istream::ignore()`](https://en.cppreference.com/w/cpp/io/basic_istream/ignore) to skip the 1st line. – Remy Lebeau Jan 05 '21 at 03:52
-
@DavidC.Rankin There are variety of file formats which start with a human-readable text line terminated by a LF or even CRLF (used as magic code) and then continue with "binary noise"... ;-) – Scheff's Cat Jan 05 '21 at 06:38
-
Just skip the amount of bytes the header occupies. There is no "line" in binary – Raildex Jan 05 '21 at 09:56
-
@Scheff Yes, but the author has to define what that terminator is, as there is no inherent "line" concept in a binary file to do it for you. – Asteroids With Wings Jan 05 '21 at 15:43