best way is to use a string array instead of char array, otherwise u hav to
deal with this ascii thing which is wee bit tricky !


to save an int as string:

int a;
string b;

b = a.ToString();


to read it back use:

a = Convert.ToInt32(b);

that would to it :)


On Fri, Jul 9, 2010 at 12:56 PM, Subrato Mukherjee <
[email protected]> wrote:

> Cannot implicitly convert from string to char is what I get. I had already
> tried that before. when I type cast the UInt64 to char it stores  its ascii
> value rather than number value in string
>
> *char[] _strOutput = new char[10]; // declaration of char array*
> *UInt64 _numberToConvert, _nInputNumber;*
> *while()*
> *{*
> *   _numberToConvert=  _nInputNumber % baseForNumber;
>    _strOutput[_counter] = (char)_numberToConvert; // this line needs to
> store the value which I need to retrieve later on and check
>   _InputNumber = _nInputNumber / baseForNumber;
>   _counter++;*
> *}*
>
> On Thu, Jul 8, 2010 at 12:50 PM, xzzy <[email protected]> wrote:
>
>>
>> while ()
>> {
>>   _strOutput[_counter] = _counter.ToString();
>>   ++_counter;
>> }
>>
>>
>> On Jul 8, 10:38 am, S <[email protected]> wrote:
>> > Hello Everyone,
>> >                       I was wondering if anyone has any ideas on how
>> > to deal with a situation where I have to store int values in char
>> > array. So I want to store '7' in char array but every thing I have
>> > tried so far has resulted in no solution.
>> >
>> > If anyone has better idea I am all ears. I am attaching the following
>> > code for everyone's reference.
>> >
>> > _numberToConvert=  _nInputNumber % baseForNumber;
>> >                 _strOutput[_counter] = _numberToConvert; // this line
>> > needs to store the value which I need to retrieve later on and check
>> >                 _nInputNumber = _nInputNumber / baseForNumber;
>> >                 _counter++;
>> >
>> > Anyone any ideas ?
>> >
>> > - S
>
>
>


-- 
Winner is not one who never fails....but, one who never QUITS.....

Reply via email to