C# streamreader, delimiter problem.

Posted by Mike on Stack Overflow See other posts from Stack Overflow or by Mike
Published on 2010-03-24T12:12:32Z Indexed on 2010/03/24 12:23 UTC
Read the original article Hit count: 360

Filed under:

What I have is a txt file that is huge, 60MB. I need to read each line and produce a file, split based on a delimiter. I'm having no issue reading the file or producing the file, my complication comes from the delimiter, it can't see the delimiter. If anybody could offer a suggestion on how to read that delimiter I would be so grateful.

delimiter = Ç

public void file1()
    {
        string betaFilePath = @"C:\dtable.txt";
        StringBuilder sb = new StringBuilder();
        using (FileStream fs = new FileStream(betaFilePath, FileMode.Open))
        using (StreamReader rdr = new StreamReader(fs))
        {
            while (!rdr.EndOfStream)
            {
                string[] betaFileLine = rdr.ReadLine().Split('Ç');
                {
                    sb.AppendLine(betaFileLine[0] + "ç" + betaFileLine[1] + betaFileLine[2] + "ç" + betaFileLine[3] + "ç" + betaFileLine[4] + "ç" + betaFileLine[5] + "ç" + betaFileLine[6] + "ç" + betaFileLine[7] + "ç" + betaFileLine[8] + "ç" + betaFileLine[9] + "ç" + betaFileLine[10] + "ç");
                }
            }
        }
        using (FileStream fs = new FileStream(@"C:\testarea\load1.txt", FileMode.Create))
        using (StreamWriter writer = new StreamWriter(fs))
        {
            writer.Write(sb.ToString());
        }
    }

© Stack Overflow or respective owner

Related posts about c#