![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to insert text in the middle of a file | kartikkumar84@g | UNIX for Dummies Questions & Answers | 6 | 05-10-2008 11:35 AM |
| insert text in the middle of a file | relle | Shell Programming and Scripting | 3 | 03-13-2008 12:37 PM |
| How to insert the 1st arg into the middle of the file | boris | Shell Programming and Scripting | 4 | 04-12-2007 09:21 PM |
| How to insert text into first line of the file and middle of the file? | ali hussain | Shell Programming and Scripting | 3 | 03-05-2007 02:54 AM |
| insert text into the middle of a original file | mopimp | Shell Programming and Scripting | 1 | 03-26-2006 07:11 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
I have a problem that I want to insert and delete some chars in the middle of a file. fopen() and fdopen() just allow to append at the end.
Is there any simple method or existing library that allow these actions? Thanks in advance. |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
Isn't there any other clever and efficient way to do that?
|
|
#3
|
|||
|
|||
|
Driver gave you the clever efficient way.
|
|
#4
|
|||
|
|||
|
anyway, thanks veru much
|
|
#5
|
|||
|
|||
|
If you have the memory, you might want to read the whole file into memory, manipulate it there and then dump the results back to disk.
That could be faster depending on a number of factors e.g number of search operations, insert/delete operations, disk performance or size of file.
__________________
Senior Analyst/Programmer |
|
#6
|
|||
|
|||
|
Quote:
|
|
#7
|
|||
|
|||
|
Quote:
My point to the OP was quite simple and old fashioned: memory is faster than disk! ( I hope that is still true these days Peace
__________________
Senior Analyst/Programmer |
|||
| Google The UNIX and Linux Forums |
| Thread Tools | |
| Display Modes | |
|
|