Help with reading text files
-
Hey im new to C# and I have to say i like it alot. my question is in a windows app (not console) is there a way to tell your program to read a specific line from a text file?
-
Hey im new to C# and I have to say i like it alot. my question is in a windows app (not console) is there a way to tell your program to read a specific line from a text file?
-
Hey im new to C# and I have to say i like it alot. my question is in a windows app (not console) is there a way to tell your program to read a specific line from a text file?
Maybe yes, maybe no. Text files are (generally) sequential rather than indexed. Without an index you can't just jump to a "line" and read it; you need to read until you find what you want.
-
Hey im new to C# and I have to say i like it alot. my question is in a windows app (not console) is there a way to tell your program to read a specific line from a text file?
Yes, if the file is not very huge (hint for very huge: size greater than 75% of your RAM), use File.ReadAllLines method to store the data of file in a string array, and depending on the input from the user (or whatever) display the line. HTH.
Do rate the reply, if it helps or even if it doesnot, because it helps the members to know, what solved the issue. Thanks.
-
Hey im new to C# and I have to say i like it alot. my question is in a windows app (not console) is there a way to tell your program to read a specific line from a text file?
The third answer you got was the right one, I just want to add, this code does not change if you're working on a console app, because it has nothing to do with the presentation part of the program.
Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )