Hi,
Is there any way to convert a file in to text data or text file?
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Selva GanapathyPosted Mar 13, 2014, 12:47 AM
Seems you are trying to convert a file into a text data. If so please using the following code to meet your requirement.
private void button1_Click(object sender, EventArgs e)
{
var bytes = File.ReadAllBytes("../../thiruvalluvar.jpg");
using (System.IO.StreamWriter file = new System.IO.StreamWriter("Text.txt")) // Open a text file to extract
{
foreach (var item in bytes)
{
file.Write(item.ToString());
}
}
System.Diagnostics.Process.Start("Text.txt");
}
output:
Regards,
Selva Ganapathy K
nathaJegamoorty PillaiPosted Mar 13, 2014, 1:49 AM
Perfect.. Thanks..
Lakshmanan Sethu SankaranarayanPosted Mar 11, 2014, 1:18 AM