can anybody tell me how to read or write Streamfield beginning from special line?
FileStream fs = new FileStream("Specifications.txt", FileMode.Open);
StreamReader sr = new StreamReader(fs);
string SpecificationsModelSettings;
SpecificationsModelSettings = sr.ReadLine(); ----> here I want to read beginning from Line "xxx"
I want to order datas in parts, and read/write only specific parts
thanx in advance

FroglegPosted Dec 7, 2013, 2:52 PM
private void button1_Click(object sender, EventArgs e)
{
int flen = File.ReadAllLines(@"Specifications.txt").Length;
string SpecificationsModelSettings = string.Empty;
bool xMode = false;
using (StreamReader sr = new StreamReader("Specifications.txt"))
{
for (int i = 0; i < flen - 1; i++)
{
SpecificationsModelSettings = sr.ReadLine();
if (!xMode)
{
if (SpecificationsModelSettings == "###")
{
xMode = true;
}
}
else if (xMode)
{
if (SpecificationsModelSettings == "###")
{
xMode = false;
}
else
{
listBox1.Items.Add(SpecificationsModelSettings);
}
}
}
}
}
and sample text
Date today
###
test 1
test 2
test 3
test 4
###
null1
null2
null3
null4
null5
###
test 5
test 6
test 7
test 8
###
null1
null2
null3
null4
null5
###
finished
###