C# character counter when writing to new line
- by Mike
Basically i'm trying to read a really big text file and when the charecters of the line reach X amount write to a new line, but i can't seem to get the charecter count to work. Any help is appricated!
using (FileStream fs = new FileStream(betaFilePath,FileMode.Open))
using (StreamReader rdr = new StreamReader(fs))
{
while (!rdr.EndOfStream)
{
string betaFileLine = rdr.ReadLine();
int stringline = 0;
if (betaFileLine.Contains("þTEMP"))
{
//sb.AppendLine(@"C:\chawkster\workfiles\New Folder\GEL_ALL_PRODUCTS_CONCORD2.DAT");
string checkline = betaFileLine.Length.ToString();
foreach (string cl in checkline)
{
stringline++;
File.AppendAllText(@"C:\chawkster\workfiles\New Folder\GEL_ALL_PRODUCTS_CONCORD3.DAT", cl);
if(stringline == 1200)
{
File.AppendAllText(@"C:\chawkster\workfiles\New Folder\GEL_ALL_PRODUCTS_CONCORD3.DAT","\n");
stringline = 0;
}
}
}
}
foreach (string cl in checkline)
Error 1 Cannot convert type 'char' to 'string'