Click here to Skip to main content
15,895,256 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
AOA

i want to know how to copy short int array into charatcer array n c#

like i have array

INT16[] array1=new INT16[30];

char[] ch=new char[30];


i want to copy the values in the array1 into ch array

how to do this plz hellp

i use copy method but it give error


Regards
Posted
Updated 23-Oct-12 23:06pm
v3
Comments
CPallini 24-Oct-12 5:00am    
Why do you need that?
(Often knowing what is the purpose of such a operation helps to find a good solution).
prog786 24-Oct-12 6:02am    
i need it because i want to write buffer data into file the data i recived in the array which is int16 type to write this data onto file i have to copy it into in a character array then write other wise as it int16 array give error for writing on the file

1 solution

Old way:
C++
Int16[] array1 = new Int16 [30];         
char[] ch = new char[30];
        for (int i = 0; i < array1.Length; i++)
             ch[i] = (char)array1[i];
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900