I want to print the ASCII values of given telugu charecters

Posted by gurramsra1-10894 under C# on 9/4/2012 | Points: 10 | Views : 2071 | Status : [Member] | Replies : 2
Hai....

I have the below code. if we run it, It will ask source path where our file with Telugu font later it will ask for destination path
to where we want to paste that Telugu font file. it will running properly. but i want the ASCII value for giving Telugu characterless
please help me....


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
using System.Web;
using System.IO;
using System.Windows.Forms; //we should add reference for this namespace

namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
//for (int i = 0; i < 1000; i++)
//{

// try
// {
// WebClient client = new WebClient();
// client.DownloadFile("http://www.99coverphotos.com/template/" + i + ".jpg", @"D:\99CoverPhotos\" + i + ".jpg");

// }
// catch
// {

// }
//}
//StreamReader sr = new StreamReader("d:\\t.txt",Encoding.UTF8);
//Console.WriteLine("?????? ??????");
//Console.WriteLine(sr.ReadToEnd());
//sr.Close();


FileStream fs = null;

try
{

string filePath = null;
while (true)
{

Console.WriteLine(@"Enter Your Telugu file path(egx:D:\telugu.txt)"+" \n\n After displaying the text in message box use mouse to click ok");
filePath = Console.ReadLine();
if (File.Exists(filePath))
break;
else
Console.WriteLine("File path does not exist, Please give proper file path");
}
fs = File.OpenRead(filePath);
byte[] bytes = new byte[fs.Length];
fs.Read(bytes, 0, Convert.ToInt32(fs.Length));

string text = System.Text.Encoding.Unicode.GetString(bytes);

//Console.WriteLine(text);

fs.Close();
MessageBox.Show(text);
Console.WriteLine(@"Enter destination File name(egx: D:\copiedFile.txt)");
string destFilePath = Console.ReadLine();
File.Copy(filePath, destFilePath);
Console.WriteLine("file copied");

}
catch (Exception ex)
{
Console.WriteLine("Exception occured : \n" + ex.Message);
}
finally
{
fs.Close();
}

Console.Read();
}
}
}


Thank you
in advance

Sravan kumar

Sra1


Responses

Posted by: Sakthi.Singaravel on: 9/5/2012 [Member] Silver | Points: 25

Up
0
Down
String value = "9quali52ty3";
byte[] asciiBytes = Encoding.ASCII.GetBytes(value);


Regards,
Singaravel M

gurramsra1-10894, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: gurramsra1-10894 on: 9/5/2012 [Member] Starter | Points: 25

Up
0
Down
Please me tell me in detail..
Where should i write these lines...



Thank you

Sra1

gurramsra1-10894, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response