reading 3 lines each time froma file

Hi, i have a file with 44 LINES, the content is:

AAAAAAAAAAAAA
1111111111111
2222222222222
77777F7777777
FFFFFFFFFFFFF
VVVVVVVVVVVVV
XXXXXXXXXXXXX
WWWWWWWWWWWWW
RRRRRRRRRRRRR
3333333333333
QQQQQQQQQQQQQ
WWZZZZZZZZZZZ
3333333333333
6666666666664
8888UUUUUUUUU
GGGGRRRRRRRRR
BBBGGGGGGGGGG
2AAAAAAAAAAAA
WWQAAAAAAAAAA
DDEZZZZZZZZZZ
WWSAZAAAZZZZZ
5555RRRREEEED
7777YYYYTTTRR
KKKKHTTFDDEES
ZZEEEERDDDFFF
98YFGFDDFFTRD
RFTTTY65YTRY5
RTER46RYRRTYT
RER453FDD6GFD
DDDGGDFGDGDGE
ETETRTER4REZZ
53F344F49HJ7H
6T0KZHZGSCZMS
RVVVDDFGDFGGD
DGDGDFGDGDGDG
TETETBVCBBCBB
GDGDGTY4TRRRY
GFGFHFHFBCBCD
GDGDGGJHJKJKJ
JKJKJKUT57577
HFGHFGHFDDVVV
878KKUI87JHJH
FGFHFHGTRYTYD
DGGTYTYTYTHGH



i wante to make a new file from this lines as presented below:

by puting each tree lines in one lines

new line 1:(LINE1){LINE2}[LINE3]
new line 2:(LINE4){LINE5}[LINE6]
...

for sample

(AAAAAAAAAAAAA){1111111111111}[2222222222222]
(77777F7777777){FFFFFFFFFFFFF}[VVVVVVVVVVVVV]
(XXXXXXXXXXXXX){WWWWWWWWWWWWW}[RRRRRRRRRRRRR]
...

please help me
You realize 3 will not divide 44 evenly ?

What have you got so far ?
Hi, yes , let say that i have a file with 45 LINES or 33 LINES.
1. Read three lines
2. Write one line
3. Repeat from 1

http://www.cplusplus.com/reference/string/string/getline/
Last edited on
Keskiverto is 100% correct but I thought I'd add a little more detail.

1
2
3
4
5
6
7
8
9
10
11
Ask for input file name
Ask for output file name

Open file, while good
loop
Read line 1 output with ()
Read line 2 output with {}
Read line 3 output with []
end loop

Close files

Topic archived. No new replies allowed.