Writing first line of a file
Hello,
Is there a way to write the first line of a file and keep the other lines already written ? For example: -> Line 5 -> Line 4 -> Line 3 -> Line 2 -> Line 1 We can call it a reverse from the log_to_file function. The only difference is that the text written inside of the file will be on a reversed order. Also, if possible, to keep only a specific number of lines, for example maximum 100. I found a sample from PHP but I think that copying the entire file content into memory, just to add one more line then rewrite the new content is bad for memory. I am wondering if it's possible to write something on the first line of a file without copying the entire file content. Thank you. |
Re: Writing first line of a file
Why do you need something like this?
|
Re: Writing first line of a file
It might be possible IIRC but it would always just overwrite was is already there I think. However, there is probably a better alternative to your supposed method. So, answer Sylwester so we can get a better idea of what you actually want to do.
|
Re: Writing first line of a file
Just use write_file(const file[],const text[],line = -1), with line index == 0.
For everything else, use new file system. |
Re: Writing first line of a file
thank you, i will give a try these days
|
| All times are GMT -4. The time now is 13:35. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.