Can anyon help me with the code to delete from file using the delete method or function
void delete()
{
}
Thanks in advance
If its a text file then you have no other choice but to rewrite the entire file. Open original file for read, open another temp file for write. In a loop read a line from input file and if its not the line you want to delete just rewrite it to the putput file. If it is the line you want to delete just ignore it and read the next line. Do that until end-of-file. Close both files. Delete the original file. Rename the temp file to the name of the original file.
If its a text file then you have no other choice but to rewrite the entire file. Open original file for read, open another temp file for write. In a loop read a line from input file and if its not the line you want to delete just rewrite it to the putput file. If it is the line you want to delete just ignore it and read the next line. Do that until end-of-file. Close both files. Delete the original file. Rename the temp file to the name of the original file.
I dont know what would I do without u, thanx man but can u provide me with a sample code so I can just replace
I dont know what would I do without u, thanx man but can u provide me with a sample code so I can just replace
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.