Good day,

I need help from you.

I have to split and create output files by every 30.000 recordings.
Example ,

Input file has 150.000 (transaction.txt) recordings of bank accounts transactions.
The C code has to split this file and create output files by 30.000 records each from input file.
(transaction1.txt, transaction2.txt, transaction3.txt and etc.).The transaction.txt (150.000 recordings) has to be split on many files with 30.000 recordings.
So , does anybody know how to do this?
How C code will look like for this operation?

Thank you very much.

Please see how Account.txt file looks.

07004262890147655236 74105616281002275393260000000001007000000002000428000000002000428LHZB ATMH0418 - Limbaz Limbazi LV 6011 1009N3049252 2 6282
0701 000000 00002 5904180 ATMH0418000000000000 000000 00 000000000
07004389380039629638 74105616281002275394193000000001007000000015000428000000015000428LHZB ATMH0401 - Elizab Riga LV 6011 1009N2084002 2 6282
0701 000000 00002 5904016 ATMH0401000000000000 000000 00 000000000
07004262890148616575 74105616281002275257663000000001007000000002000428000000002000428LHZB ATMH0422 - Aizkra Aizkraukle LV 6011 1009N2201432 2 6282
0701 000000 00002 5904222 ATMH0422000000000000 000000 00 000000000
07004262890146321046 74105616281002275252417000000001007000000010000428000000010000428LHZB ATMH0433 - Kudras Riga LV 6011 1009N3462742 2 6282
0701 000000 00002 5904339 ATMH0433000000000000 000000 00 000000000
07004262890146321046 74105616281002275252409000000001007000000002000428000000002000428LHZB ATMH0433 - Kudras Riga LV 6011 1009N3369872 2 6282
0701 000000 00002 5904339 ATMH0433000000000000 000000 00 000000000
07004262890144868220 74105616281002275252391000000001007000000002000428000000002000428LHZB ATMH0433 - Kudras Riga LV 6011 1009N3123242 2 6282
0701 000000 00002 5904339 ATMH0433000000000000 000000 00 000000000
07004262890147233141 74105616281002275252342000000001007000000001000428000000001000428LHZB ATMH0433 - Kudras Riga LV 6011 1009N2373252 2 6282
0701 000000 00002 5904339 ATMH0433000000000000 000000 00 000000000
07004262890146395032 74105616281002275252300000000001007000000001000428000000001000428LHZB ATMH0433 - Kudras Riga LV 6011 1009N2273262 2 6282
0701 000000 00002 5904339 ATMH0433000000000000 000000 00 000000000
07004262890146802094 74105616281002275252292000000001007000000005000428000000005000428LHZB ATMH0433 - Kudras Riga LV 6011 1009N2232802 2 6282
0701 000000 00002 5904339 ATMH0433000000000000 000000 00 000000000
07004262890144868220 74105616281002275252326000000001007000000003000428000000003000428LHZB ATMH0433 - Kudras Riga LV 6011 1009N2325232 2 6282
0701 000000 00002 5904339 ATMH0433000000000000 000000 00 000000000
07004389380039446967 74105616281002275252334000000001007000000005000428000000005000428LHZB ATMH0433 - Kudras Riga LV 6011 1009N2355882 2 6282
0701 000000 00002

first learn to open a file using fopen(), read a line from the input file using fgets() and write the same line to the output file using fprintf(). Once you can do that, come back and talk about how to actually split the file into two or more files.

This article has been dead for over six months. Start a new discussion instead.