Hi evryone
I have this snippet
FileStream fileStream = null;<br/>
StreamReader streamReader = null;
private bool openFile(string nomFile)<br/>
{<br/>
try<br/>
{<br/>
fileStream = new FileStream(nomFile, FileMode.Open);<br/>
return true;<br/>
}<br/>
catch<br/>
{<br/>
return false;<br/>
}<br/>
}<br/>
<br/>
private void readFile(string nomFile)<br/>
{<br/>
string line;<br/>
<br/>
if (openFile(nomFile))<br/>
{<br/>
<br/>
try<br/>
{<br/>
streamReader = new StreamReader(fileStream);<br/>
while ((line = streamReader.ReadLine()) != null)<br/>
{<br/>
Console.WriteLine(line);<br/>
}<br/>
<br/>
}<br/>
finally<br/>
{<br/>
if (streamReader != null)<br/>
streamReader.Close();<br/>
}<br/>
}<br/>
<br/>
<br/>
}
Id like to know how to read directy in a precise line
I mean if I like to read from the 6th line or the 12 line
how to do that?I dont like to read all the lines to attend the 6 or the 12 line
its possible to do for exemple line[5] to get the 6th line?
because I have many methode to get data
private string getRef(StreamReader str)<br/>
{
string lineIndex = str[5] \ that its not possilbe Im asking how to do that<br/>
return lineIndex<br/>
}<br/>
<br/>
private string getDate(StreamReader str)<br/>
{
string lineIndex = str[6] \ that its not possilbe Im asking how to do that<br/>
return lineIndex<br/>
}
I hope that you understand what Im looking for
View the full article
I have this snippet
FileStream fileStream = null;<br/>
StreamReader streamReader = null;
private bool openFile(string nomFile)<br/>
{<br/>
try<br/>
{<br/>
fileStream = new FileStream(nomFile, FileMode.Open);<br/>
return true;<br/>
}<br/>
catch<br/>
{<br/>
return false;<br/>
}<br/>
}<br/>
<br/>
private void readFile(string nomFile)<br/>
{<br/>
string line;<br/>
<br/>
if (openFile(nomFile))<br/>
{<br/>
<br/>
try<br/>
{<br/>
streamReader = new StreamReader(fileStream);<br/>
while ((line = streamReader.ReadLine()) != null)<br/>
{<br/>
Console.WriteLine(line);<br/>
}<br/>
<br/>
}<br/>
finally<br/>
{<br/>
if (streamReader != null)<br/>
streamReader.Close();<br/>
}<br/>
}<br/>
<br/>
<br/>
}
Id like to know how to read directy in a precise line
I mean if I like to read from the 6th line or the 12 line
how to do that?I dont like to read all the lines to attend the 6 or the 12 line
its possible to do for exemple line[5] to get the 6th line?
because I have many methode to get data
private string getRef(StreamReader str)<br/>
{
string lineIndex = str[5] \ that its not possilbe Im asking how to do that<br/>
return lineIndex<br/>
}<br/>
<br/>
private string getDate(StreamReader str)<br/>
{
string lineIndex = str[6] \ that its not possilbe Im asking how to do that<br/>
return lineIndex<br/>
}
I hope that you understand what Im looking for
View the full article