-3

C++ problem. I have a text file with no "carriage return" or "new line".

All the words are concatenate in a whole single block.

I want to divide the file in lines by substituting every substring "ABC" with the "carriage return" or "new line" character.

P.S: I can't scan the file line by line because the file is actually a single line, bigger than the max value allowed for a single string (string::max_size).

Tunaki
  • 132,869
  • 46
  • 340
  • 423
user3133076
  • 75
  • 1
  • 2
  • 11

1 Answers1

0

I solved with the following code:

ifstream  input("File_In");
ofstream output("File_Out");

for (unsigned long long int SEEK=0 ; SEEK<(MAX_LIMIT) ; SEEK++)
{
input.seekg(SEEK);
char tmp[4] ;
input.read(tmp,3);
output<<tmp[0];
if (string(tmp)=="ABC") output<<'\n';
};
user3133076
  • 75
  • 1
  • 2
  • 11