How can i cut out every 4 characters from a text file?
Example: my text file rows of binary numbers like: 101010101000010101010111
i wanted to cut out every 4 characters from it becomes:
1010
1010
1000
0101
....
....
.....
i have been bale to cut out the 4 characters but is looping the 4 character for the length of the row...
string line, bits;
while(getline(fin,line))
{
for(int i=0; i<line.length(); i++)
{
for(int n=0; n<4; n++)
{
bits = line[n];
fout << bits;
}fout<<endl;
}
}