Prepend to file -- help?
Posted: Mon Aug 15, 2005 11:18 pm
Hello everyone, I am Quadricode!
Anyway, that is my introduction. I will get straight to my question.
I am making an arbitrary precision calculator, but I am having a problem. It is as follows:
I have the user input numbers (via INKEY$), and it is directly put into a file names Num1.txt (and Num2.txt). Everything is good so far.
My algorithms require there to be leading zeros, and I need to know how to put on the leading zeros in the text file (prepending line number 1) AS WELL AS taking carry-overs over 40 digits, and putting them into the next line.
[The following is an example file]
Original File
et cetera. Note that each row has 40 characters (or less). Let us pretend I need to prepend 9 zeros. How can I put the zeros in the first line, and then take the overflow (numbers past the 40 char mark), and set them into the next line?
What I need.
From above, to this:
(Brackets are the overflowing numbers/inserted numbers.)
Final Result (num1.txt):
I hope I was coherent and articulate. Any help would be fine. I just hope I won't have to rebuild everything everytime a carry-over has to occur.
Anyway, that is my introduction. I will get straight to my question.
I am making an arbitrary precision calculator, but I am having a problem. It is as follows:
I have the user input numbers (via INKEY$), and it is directly put into a file names Num1.txt (and Num2.txt). Everything is good so far.
My algorithms require there to be leading zeros, and I need to know how to put on the leading zeros in the text file (prepending line number 1) AS WELL AS taking carry-overs over 40 digits, and putting them into the next line.
[The following is an example file]
Original File
Code: Select all
48923678924367043297309861037640398087423
58970276487136083468437614387647643471031
16767105757657647031658704670657765
What I need.
From above, to this:
Code: Select all
[000000000]48923678924367043297309861037640[398087423]
58970276487136083468437614387647643471031
16767105757657647031658704670657765
to
[000000000]48923678924367043297309861037640
[398087423]58970276487136083468437614387647[643471031]
16767105757657647031658704670657765
to
[000000000]48923678924367043297309861037640
[398087423]58970276487136083468437614387647
[643471031]16767105757657647031658704670657[765]
to
[000000000]48923678924367043297309861037640
[398087423]58970276487136083468437614387647
[643471031]16767105757657647031658704670657
[765]
Final Result (num1.txt):
Code: Select all
00000000048923678924367043297309861037640
39808742358970276487136083468437614387647
64347103116767105757657647031658704670657
765