PDA

View Full Version : write the data to text file



vanduongbk
13th September 2013, 09:48
hi everyone
i want to write a data to a txt file with format as:
1 data1
2 data2
....
n ..datan

how i can write the data only to n=1000, if greater than 1000 ,it will begin write overwritten to 1 ,2 ...

aamer4yu
13th September 2013, 10:33
Check the file size before you write. If it is greater than 1000, seek position to the begin of the file.

You may also need to open file in append mode. Do confirm.

anda_skoa
13th September 2013, 12:55
hi everyone
i want to write a data to a txt file with format as:
1 data1
2 data2
....
n ..datan


Are those separate lines?
Is each line the same length?

Cheers,
_

vanduongbk
13th September 2013, 17:07
Are those separate lines?
Is each line the same length?

Cheers,
_

hi,
yes,it's separate line but its length is not similar as
1 10
2 100
3 13.76
....



hi aamer4yu

If it is greater than 1000, seek position to the begin of the file.
how can I do this ,can you explain it by a simple example

Lesiok
13th September 2013, 18:30
After reaching the 1000 lines, you must create a file from scratch. This is impossible to put 10 characters in place of 5 characters.