problem with passing values to char array

Asked By krishna k
01-Mar-06 03:28 AM
Earn up to 0 extra points for answering this tough question.
hi every one, here iam having the problem about charecter array. In C Language he used pass the values as bellow public unsafe struct x25data { char xd_data[]; int xd_len; } but here he is passing values as follows x25data.xd_data[0]=0x42; x25data.xd_data[1]=0x07; x25data.xd_data[2]=0x07; how can we pass the same values in C#.net. can we pass them as he passed in c. help me in this please.

  Array

Asked By Shallu Gupta
01-Mar-06 03:45 AM
yeah you can do this.. see this example.. [CODE] string [] test = new string[2]; test[0]= "first"; test[1]= "second"; [/CODE]

  cannot convert string[] to char[] will occur know

Asked By Raja yashwanth Reddy Gunda
01-Mar-06 04:32 AM
here this charecter array was defined in dll. i want to use the dll in my application,for that the above i given that example. can we that hexadecimal values as elements of an array.

  convert hexadecimal values to char

Asked By Pankaj Sharma
01-Mar-06 04:45 AM
Hi, Is it this you need? [CODE] public struct Test { public char[] arrTest; public Test(int intLen) { arrTest= new char[intLen]; } } //Declaring a struct object Test temp = new Test(2); //converting it into char temp.arrTest[0]= Convert.ToChar(0x42); Console.WriteLine(temp.arrTest[0]); //It displays B on console. [/CODE]
  convert hexadecimal values to char
Asked By Pankaj Sharma
01-Mar-06 04:48 AM
Hi, Is it this you need? [CODE] public struct Test { public char[] arrTest; public Test(int intLen) { arrTest= new char[intLen]; } } //Declaring a struct object Test temp = new Test(2); //converting it into char temp.arrTest[0]= Convert.ToChar(0x42); //It displays B on console. Console.WriteLine(temp.arrTest[0]); [/CODE]
  clarification on the values saved in the example
Asked By Raja yashwanth Reddy Gunda
01-Mar-06 05:04 AM
with reference to your answer in c the values which are saved are passed as hexadecimal values to the calling position( i.e to the x25 Protocol) does the same happen in c# I think that char (0x47) i.e char 66 i.e B will be passed this doesnot solve my problem
Create New Account