Problem With File Writing
I am writing some data (like some 10000 bytes) to a file Once it reaches the maximum size then the first data has to be deleted and the new data should be written at the bottom.
12345 --Need to delete this line(First Line)
12345 --Need to insert this line(At the bottom)
Could somebody suggest me something
Re: Problem With File Writing
I guess one approach is that if each piece of data is on one line, you could use an array. Read the data from the file into an array, using the line breaks to separate the elements of the array, so you get something like this:
theData = '12345';
theData = '23456';
Then just assign the next value to a new element in the array (I think this is possible...), then delete the first element of the array.
Then iterate over the array, and write back to the file.
That's just off the top of my head. There are probably better solutions.