#Delete 128 bytes of a file.

10 messages · Page 1 of 1 (latest)

tepid wigeonBOT
#

When your question is answered use !solved or the button below to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.

plucky osprey
#

I have the following solution in mind:

  • fopen the file in read mode
#
  • copy the contents to a buffer
  • reopen the file in write mode (destroys the contents)
  • write it back (excluding your 128 bytes)
floral parcel
#

and if the process dies for whatever reason - bye, bye file

#

a popular method is to write to a new file, then rename the new to old, overwriting the old one, but rename() doesn't have the greatest guarantees in C per se

#

this is the life in C, the standard library is tiny, and lacks many things, so either you #ifdef your way through multiple platforms or you use 3rd party libraries, that do

tepid wigeonBOT
#

This question is being automatically marked as stale.
If your question has been answered, type !solved.
If your question is not answered feel free to bump the post or re-ask.
Take a look at !howto ask for tips on improving your question.

tepid wigeonBOT
#

<@undefined>

Please Do Not Delete Posts!

Please don't delete forum posts. They can be helpful to refer to later and other members can learn from them. In the future you can use !solved to close a post and mark a post as solved.