![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Remove first N bytes and last N bytes from a binary file on AIX. | naveendronavall | Shell Programming and Scripting | 1 | 05-24-2008 11:06 AM |
| How to delete initial N bytes from the starting of the file using sed? | jockey007 | Shell Programming and Scripting | 3 | 11-19-2007 08:26 PM |
| Delete lines starting with XX or YY or ZZ or .... | orno | Shell Programming and Scripting | 2 | 11-13-2007 05:33 PM |
| delete bytes from file | Loriel | Shell Programming and Scripting | 6 | 04-13-2006 01:27 PM |
| Take a file from the system and put on tape and reset the file to 0 bytes | JackieRyan26 | UNIX for Dummies Questions & Answers | 1 | 09-06-2001 05:08 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
How to delete N bytes from the starting of the file from a C function???
Hi,
I want to delete the initial few lines (or even bytes) from a file. I want to do this from a C function & this is in Linux platform. The truncate & ftruncate is allowing me to delete bytes from the end only. Any linux C function calls or ideas or any suggestions?? I'm in a dead lock..Plz help Wishes Jay |
|
||||
|
No, there is no function to delete from the middle of a file, only to truncate.
You have two options (a) open one file, read buffer fulls and write earlier in the file until you get to the end then truncate (b) open a new file, copy the data you want to keep to the new file and then close it and rename it onto the original. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|