Search EggHeadCafe's Job Board
EggHeadCafe Silverlight WPF ASP.NET VB.NET C# Excel SQL Server SharePoint
search
MicrosoftArticlesForumsFAQs
C# .NET
VB.NET
Visual Studio .NET
ADO.NET
Xml / Xslt
VB 6.0
.NET CF
GDI+
LINQ
Deployment
Security
FoxPro
Silverlight / WPF
Entity Framework
RIA Services

WebArticlesForumsFAQs
JavaScript
ASP
ASP.NET
WCF

DatabasesArticlesForumsFAQs
SQL Server
Access
Oracle
MySQL
Other Databases

OfficeArticlesForumsFAQs
Excel
Word
Powerpoint
Outlook
Publisher
Money

Non-MicrosoftArticlesForumsFAQs
NHibernate
Perl
PHP
Ruby
Java
Linux / Unix
Apple
Open Source

Operating SysArticlesForumsFAQs
Windows 7
Windows Server
Windows Vista
Windows XP
Windows Update
MAC
Linux / UNIX

Server PlatformsArticlesForumsFAQs
BizTalk
Site Server
Exhange Server
IIS

Graphic DesignArticlesForumsFAQs
Macromedia Flash
Adobe PhotoShop
Expression Blend
Expression Design
Expression Web

OtherArticlesForumsFAQs
Lounge
Subversion / CVS
Ask Dr. Dotnetsky
Active Directory
Networking
Uninstall Virus
Job Openings
Product Reviews
Search Engines
Resumes

 

  View Other C# .NET Posts   Ask New Question  Ask New Question With Power Editor

problem with passing values to char array
krishna k posted at Wednesday, March 01, 2006 3:28 AM

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.
Reply    Reply Using Power Editor
  Rank Winnings Points
November 0 $0.00 0
October 0 $0.00 0
Array
Shallu Gupta provided a rated reply on Wednesday, March 01, 2006 3:45 AM

yeah you can do this..
see this example..
[CODE]
string [] test = new string[2];
test[0]= "first";
test[1]= "second";
[/CODE]
Reply    Reply Using Power Editor
  Rank Winnings Points
November 0 $0.00 0
October 0 $0.00 0

cannot convert string[] to char[] will occur know
Raja yashwanth Reddy Gunda replied on Wednesday, March 01, 2006 4: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.
Reply    Reply Using Power Editor
  Rank Winnings Points
November 0 $0.00 0
October 0 $0.00 0

convert hexadecimal values to char
Pankaj Sharma provided a rated reply on Wednesday, March 01, 2006 4: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]
Reply    Reply Using Power Editor
  Rank Winnings Points
November 0 $0.00 0
October 0 $0.00 0

convert hexadecimal values to char
Pankaj Sharma replied on Wednesday, March 01, 2006 4: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]
Reply    Reply Using Power Editor
  Rank Winnings Points
November 0 $0.00 0
October 0 $0.00 0

clarification on the values saved in the example
Raja yashwanth Reddy Gunda replied on Wednesday, March 01, 2006 5: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
Reply    Reply Using Power Editor
  Rank Winnings Points
November 0 $0.00 0
October 0 $0.00 0