How is it possible to delete a byte ( char, int, double .. ) from a text file ?

Suppose that the file.txt contains :"110Hello". And I want to delete "110" from the file leaving only the "Hello" part.

How to do this without reading the whole file into the memory and then rewriting the edited data ?

Thanks.

Recommended Answers

All 2 Replies

you have to completly rewrite the file -- read the file into memory then write it back out but omitting the part you want to delete.

You can't. You need to read old and write new.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.