How to delete in File

So i have to delete a certain text (or replace it with white space)
in c.

so i have a file:

oranges 556 44 usa
Apples 44 66 ma

now lets say i am at apples with my file pointer, i want to delete everything after till newline so end of ma.
I'm not exactly sure what you're asking, can you show some kind of code or explain it with better english?
well i have a text file with content:

oranges place:canada season:summer
Apples place:usa season:summer
Kiwi place:Southamerica season:summer

//
now i search through the file, to delete the whole line "Apples place:usa season:summer"
i am not so sure how i can delete just that one line.

i though about,
1. creating a temp file
2. copying everything from this file expect for the line "Apples place:usa season:summer"
3. deleting the original file
4. renaming the temp file to the original name.

but i don't know how to delete a file nor how to rename a file
I don't exactly know, I'm a beginner as well, however have you researched into the fstream library? becuase that's almost definitely going to be where you find what you need.
i have, but no so help full
Ok, gimme a few minutes and I will look into some stuff.
Ok, I don't know how this command is used to its full extent, however I think this is what you need http://cplusplus.com/reference/iostream/ostream/write/ if you are going to open and delete from files.
Topic archived. No new replies allowed.