This is a discussion on reading data from a file using C# within the C# Programming forums, part of the Software Development category; How to read a data in a file using C#?...
| |||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
| |||
| Hi... Use the following coding for read a data in a file using C#. fs = new FileStream("log.txt", FileMode.OpenOrCreate, FileAccess.Read); StreamReader r = new StreamReader(fs); r.BaseStream.Seek(0, SeekOrigin.Begin); DumpLog( r ); public static void DumpLog (StreamReader r) { while (r.Peek() > -1) { // While not at the end of the file, write to standard output. Console.WriteLine(r.ReadLine()); } r.Close(); } |
| |||
| Hi buddy, Use as follows, string[] str = File.ReadAllLines(@"C:/test.txt"); if (str.Length > 0) { for (int i = 0; i < str.Length; i++) { MessageBox.Show(str[i]); } }
__________________ S.VinothkumaR Behind me is infinite power, Before me is Endless Possibility, Around me is Boundless Opportunity, Why should I fear! |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Reading IPTC data from Nikon camera RAW images,JPEG,TIFF files using Adobe dll in C# | oxygen | C# Programming | 1 | 02-28-2008 11:33 PM |
| Reading and Writing to File using UTL_FILE in ORACLE | Murali | Database Support | 2 | 08-23-2007 11:12 PM |
| Which is faster- Reading word size data whose starting address is at even or at odd a | Arun | Computer Hardware | 0 | 07-18-2007 09:03 AM |
| Reading and writing EXIF meta data from jpg/jpeg,tiff images | oxygen | C# Programming | 0 | 07-15-2007 11:24 PM |
| Reading WMV file meta data in .Net | oxygen | C# Programming | 0 | 07-15-2007 11:18 PM |