arul

arul

  • NA
  • 26
  • 0

Convert Byte[] to string

Sep 16 2008 6:57 AM

Hi,
i want to get the PST file path from the registry using c# windows application.this is code.

RegistryKey rootKey = Registry.Users.OpenSubKey(@"S-1-5-21-1107897091-684665201-52263381-211903\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles\Microsoft Outlook\0a0d020000000000c000000000000046");
            ASCIIEncoding enc = new  ASCIIEncoding();
            byte[] ans = (byte[])rootKey.GetValue("001f0324");
            MessageBox.Show(enc.GetString(ans).ToString());
        
            for (int x = 0; x < ans.Length; x++)
            {
                listBox1.Items.Add(String.Format("{0:x2}", ans[x]));
            }
here the output(enc.GetString(ans)) string return only "C".the actual output in the registry is "C:\Documents and Settings.....pst" 
but i could not get the full value.
how can i do it? can you please help me out ?

Thanks and Regards

Arul

 


Answers (2)