How to Split a txt file.
-
Hi Friends, I have a MHTML file, i have to Split it in to Number of files, First from the Header of the file as header. Then we have a String in as "PAGE-BREAK-AFTER". I have to read this file and find this string, till that string i have to make a new file1, like that there are lot of "PAGE-BREAK-AFTER" String, Could any one tell me. How to do this, some logic.
Thanks and Regards. SANTHOSH V
-
Hi Friends, I have a MHTML file, i have to Split it in to Number of files, First from the Header of the file as header. Then we have a String in as "PAGE-BREAK-AFTER". I have to read this file and find this string, till that string i have to make a new file1, like that there are lot of "PAGE-BREAK-AFTER" String, Could any one tell me. How to do this, some logic.
Thanks and Regards. SANTHOSH V
That can be easily done:
(0) if you have reached endo of file exit
(1) Read a line and append it to your buffer
(2) Search the line for the "PAGE-BREAK-AFTER" separator
(3) if the separator is not found go to point (0)
(4) write buffer content to new file
(5) erase buffer
(6) go to point (0):)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.