read file from bottom
-
I need to read a file from the bottom is it possible in c language ? The exact requirement is suppose having a file like ======================================== hi how are you exit 1 then you exit 1 and i can make this exit 0 =========================================== I need to read the file from bottom to search the last exit 1 and print the lines above it the output will be then you Can anybody help me ??
vineesh
-
I need to read a file from the bottom is it possible in c language ? The exact requirement is suppose having a file like ======================================== hi how are you exit 1 then you exit 1 and i can make this exit 0 =========================================== I need to read the file from bottom to search the last exit 1 and print the lines above it the output will be then you Can anybody help me ??
vineesh
Hello Vineesh, Trh using the given code snippet. You need to import the namespace System.IO. using System.IO; BEGIN CODE
StreamReader sr = new StreamReader("C:\\Test.txt"); String str; str = sr.ReadToEnd(); int index= str.LastIndexOf("exit 1"); TextBox1.Text=str.Substring(0,index);
END CODE I hope this will meet your requirement. Regards, AllenAllen Smith ComponentOne LLC www.componentone.com
-
Hello Vineesh, Trh using the given code snippet. You need to import the namespace System.IO. using System.IO; BEGIN CODE
StreamReader sr = new StreamReader("C:\\Test.txt"); String str; str = sr.ReadToEnd(); int index= str.LastIndexOf("exit 1"); TextBox1.Text=str.Substring(0,index);
END CODE I hope this will meet your requirement. Regards, AllenAllen Smith ComponentOne LLC www.componentone.com
hi, File.ReadAllBytes returns a byte array which can be then used the way you want to play with it. Regards. Atif Ali Bhatti.
-
Hello Vineesh, Trh using the given code snippet. You need to import the namespace System.IO. using System.IO; BEGIN CODE
StreamReader sr = new StreamReader("C:\\Test.txt"); String str; str = sr.ReadToEnd(); int index= str.LastIndexOf("exit 1"); TextBox1.Text=str.Substring(0,index);
END CODE I hope this will meet your requirement. Regards, AllenAllen Smith ComponentOne LLC www.componentone.com