0

1. I Need to search in a file by reading it character by character, the problem is that each line ends with spaces before the next line begins......... how to remove spaces between lines and make the search contiue automatically.


2. In another case I need to read a file line by line and process it. to ger a new file where each line contains no more that 30 characters and the rest of characters make a new line and so on........... .

2
Contributors
3
Replies
4
Views
6 Years
Discussion Span
Last Post by abelLazm
0

am reading line of the first line as string, using strlen() calculate the size then divide string into parts (parse string)......... write to the text file again.... still working on it .

for removing spaces from the end of files, I dont know how to do it ........ I have one idea I am working on......... read character by character if its not space write to anew file if its space read the next character..................still working on it

0

Use this code to read the lines it will automatically read the lines in the file

string filename="D:\folder\file.txt";
  using (StreamReader reader = new StreamReader(@filename))
    {      
        while ((S = reader.ReadLine()) != null)
        {
          //YOUR CODE           
                
            }
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.