Read the file line by line and write each line out to a temp file as you read it. When you get to the line you want to delete, simply don't write it out. When you've gone through the whole file, rename the temp file to the original. (You might have to explicitly delete the original first, I'm not sure.)