1. ## ascii to str

hello.

here is a(maby a really stupid) qestion.

how can i convert a hex (in a string) to a dec int

and what must i do to get the char (which ascii number my int contains) into a string or char*??

or is there an easyer way to get the hex number in a textfiled to the char??

thanx

2. I assume you know how to convert a hexadecimal to decimal number? Well, just read each character from the string and apply that algorithm. The result for each character should be added to the sum and the result, the sum, can be placed in the integer.

3. How about a hex string to a long.
Code:
```#include <stdlib.h>
.
.
char str[10] = "ffff";
long num;
char *endptr;

num = strtol(str,&endptr,16);
cout << num << endl;```

4. thankyou.

i´ve got it already. thought that there is a single command for this.....

by the way:

why is
Edit1->Text=(char)"0x43"+(char)"0x30";

not the same as

Edit1->Text=(char)"0x43";
Edit1->Text=Edit1->Text+(char)"0x30";

??????

5. Is Edit1->Text of type string?

6. yes. i´m using borland c++builder5. Edit1 is my editbox and it´s text is of type AnsiString.

7. >why is
>Edit1->Text=(char)"0x43"+(char)"0x30";

>not the same as

>Edit1->Text=(char)"0x43";
>Edit1->Text=Edit1->Text+(char)"0x30";

I'll take a guess.

In case 1, I would guess it interprets the + as addition (because both operands are of type char).

In case 2, I would guess it interprets the + as concatenation (since the first operand is a string).

8. -swoopy
you seem to be right.

what must i do to get the concatenation in a single line.
is there a other operator than "+"??

9. -wesentlich,
you could try:

Edit1->Text= (AnsiString)(char)"0x43"+(AnsiString)(char)"0x30";

assuming the compiler takes it. Also, I'm thinking this could be written:

Edit1->Text= (AnsiString)(char)0x43+(AnsiString)(char)0x30;

10. thanx.
Edit1->Text= (AnsiString)(char)0x43+(AnsiString)(char)0x30;
works