I have a more simple solution, with a file, to write and delete lines in the file. String line = Logguer.getLineToServer(indexLine) To use Notepad++ for this, open the View menu, open the Show Symbols slide out, and select either 'Show all characters' or 'Show end-of-line characters'. But you do get to see the line-ending characters. However, it will still insert the line breaks. Return (listLineValidated.Count = numberOfLine) It shows CR and LF, instead of '\r' and '\n', but it gets the point across. Public static void addLineValidated(int lineNumber) StreamReader file = new StreamReader(fileNameLogguerToServer) If (File.Exists(fileNameLogguerToServer))
Quick solution for text based apps where you might want to delete text output.
Public static string getLineToServer(int lineNumber)įileNameLogguerToServer = getFileNameLog(fileNameLogguerToServer) Java How to Delete Edit Text in Console - Free download as PDF File (.pdf), Text File (.txt) or read online for free. Static List listLineValidated = new List() When all line are writen, I delete the file.
While the program reads all file and parse the info into the string I can go to lunch! If I can read the file and parse the data directly to the DB, I will avoid the double read of info.įor this problems I use a fonction that determine wich line is correctly write in database. StreamWriter swFromFileTrueUTF8Buffer = new StreamWriter(fs, MyFile = myFile + fileArray.ToString() įileStream fs = new FileStream(fileName,FileMode.OpenOrCreate, The line order/sorting will not be affected other than subsequent duplicate lines being deleted. Duplicate text removal is only between content on new lines and duplicate text within the same line will not be removed. iterate over the Array which contains each line of the file Enter text here, select options and click the 'Remove Duplicate Lines' button from above. For better performance use a StringBuilder Split the file into an array using a newline character as the split character MyFile = myFile + srRead.ReadLine() + "\n" (0, SeekOrigin.Current) //what does SeekOrigin.Current do? When you delete a line in a text editor like Notepad, thats literally what it does-it rewrites the.
String fileName = srRead = File.OpenText(fileName) How to delete a line from a text file using C. I have some code, but the program seems to hang up a lot. Now, how can I walk the file starting from the line number 3? (skipping the header)