Click here to Skip to main content
15,905,008 members
Home / Discussions / C#
   

C#

 
GeneralRe: How do I respond to a protocol like http://, but more like myProtocol:// ? Pin
Program.X21-Mar-07 12:19
Program.X21-Mar-07 12:19 
QuestionQuestion about Web Services Pin
Khoramdin21-Mar-07 7:07
Khoramdin21-Mar-07 7:07 
Questionmonitor folder Pin
arkiboys21-Mar-07 7:02
arkiboys21-Mar-07 7:02 
AnswerRe: monitor folder Pin
Laxman Auti21-Mar-07 7:19
Laxman Auti21-Mar-07 7:19 
GeneralRe: monitor folder Pin
arkiboys21-Mar-07 22:44
arkiboys21-Mar-07 22:44 
QuestionHow to get the count of lines in .txt file Pin
CodeItWell21-Mar-07 6:59
CodeItWell21-Mar-07 6:59 
AnswerRe: How to get the count of lines in .txt file Pin
Edmundisme21-Mar-07 7:32
Edmundisme21-Mar-07 7:32 
GeneralRe: How to get the count of lines in .txt file Pin
Wayne Phipps21-Mar-07 9:24
Wayne Phipps21-Mar-07 9:24 
I would personally prefer to use StreamReader, it certainly looks more elegant.
int lineCount = 0;
// Create an instance of StreamReader to read from a file.
// The using statement also closes the StreamReader.
using (System.IO.StreamReader sr = new System.IO.StreamReader("myFile.txt"))
{
    // Read and display lines from the file until the end of the file is reached.
    while ( sr.ReadLine() != null) lineCount++;
}
Console.WriteLine( "Line Count: " + lineCount.ToString() );


Obviously you should add some error checking like making sure the file exists ETC but that should otherwise do the job.


Hope it helps




Regards

Wayne Phipps
____________

Time is the greatest teacher... unfortunately, it kills all of its students
View my Blog

GeneralRe: How to get the count of lines in .txt file Pin
Edmundisme21-Mar-07 9:44
Edmundisme21-Mar-07 9:44 
AnswerRe: How to get the count of lines in .txt file Pin
Dave Kreskowiak21-Mar-07 8:47
mveDave Kreskowiak21-Mar-07 8:47 
AnswerRe: How to get the count of lines in .txt file Pin
sherifffruitfly21-Mar-07 18:17
sherifffruitfly21-Mar-07 18:17 
Questionrecieving output from dos Pin
sharpiesharpie21-Mar-07 6:27
sharpiesharpie21-Mar-07 6:27 
AnswerRe: recieving output from dos Pin
szukuro21-Mar-07 6:36
szukuro21-Mar-07 6:36 
AnswerRe: recieving output from dos Pin
Dan Neely21-Mar-07 6:51
Dan Neely21-Mar-07 6:51 
AnswerRe: recieving output from dos Pin
Stefan Troschuetz21-Mar-07 6:54
Stefan Troschuetz21-Mar-07 6:54 
QuestionStrange behaviour Pin
sinosoidal21-Mar-07 6:17
sinosoidal21-Mar-07 6:17 
AnswerRe: Strange behaviour Pin
Stefan Troschuetz21-Mar-07 6:49
Stefan Troschuetz21-Mar-07 6:49 
GeneralRe: Strange behaviour Pin
sinosoidal21-Mar-07 6:50
sinosoidal21-Mar-07 6:50 
GeneralRe: Strange behaviour Pin
sinosoidal21-Mar-07 6:53
sinosoidal21-Mar-07 6:53 
GeneralRe: Strange behaviour Pin
Stefan Troschuetz21-Mar-07 6:58
Stefan Troschuetz21-Mar-07 6:58 
GeneralRe: Strange behaviour Pin
sinosoidal21-Mar-07 7:39
sinosoidal21-Mar-07 7:39 
AnswerRe: Strange behaviour Pin
Edmundisme21-Mar-07 7:05
Edmundisme21-Mar-07 7:05 
GeneralRe: Strange behaviour Pin
sinosoidal21-Mar-07 7:33
sinosoidal21-Mar-07 7:33 
GeneralRe: Strange behaviour Pin
Edmundisme21-Mar-07 7:42
Edmundisme21-Mar-07 7:42 
GeneralRe: Strange behaviour Pin
sinosoidal21-Mar-07 7:51
sinosoidal21-Mar-07 7:51 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.