Go Down

### Topic: integer to char (Read 887 times)previous topic - next topic

#### Mohamed_Aouf

##### May 05, 2013, 11:29 am
how can i convert Integer to char ??

#### pantzmaster

#1
##### May 05, 2013, 11:31 am
See if anything in this thread helps:

http://arduino.cc/forum/index.php/topic,41352.0.html

#### Mohamed_Aouf

#2
##### May 05, 2013, 11:38 am
do u know bro how to concatenation 2 characters ?
Val1[] = "aaaaa";
val2[] = "bbbbbb";
i want to show val1+vla2
do u know how?

#### AWOL

#3
##### May 05, 2013, 12:04 pm
strcat, but that's not the answer to your original question.
A char already is an integer.
It isn't an int, though.
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

#### aarondc

#4
##### May 05, 2013, 12:07 pm
Code: [Select]
`// you can cast it like this:int i = 7;char ch;void setup() {    Serial.begin(9600);    ch = (char)i;  Serial.println(i);  Serial.printlin(ch);}`
Windows serial port monitor: Tellurium | Arduino serial port debugging library: DBG | Cusom LCD char generator | Technical questions will only be answered in forum threads

#### PaulS

#5
##### May 05, 2013, 02:34 pm
Quote
// you can cast it like this:

Not a good idea, really. What happens if i is 12894 or -4582?

OP: You need to clarify what you want to do. Converting an int to a string is one thin (that makes sense). Converting an int to a char is another (that doesn't necessarily make sense).

#### simonfile

#6
##### May 05, 2013, 04:43 pm
It seems that you have two questions: 1-int to char?  Please use the function" itoa()"; 2-Adding two chars together? Please consider using" String".

#### AWOL

#7
##### May 05, 2013, 04:54 pm
Please, don't consider entertaining the possibility of allowing the thought to cross your mind of using String
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

#### Mohamed_Aouf

#8
##### May 05, 2013, 04:54 pm
i use function that only take char variable
i want to make concatenation with them
int x=1;
char x="number1" ;

i want to print "number 1" in my fuction that only take char ......convert int to char done ....now i only have problem to  concatenation 2 char

#### billroy

#9
##### May 05, 2013, 04:57 pm
It is not necessary to concatenate two things to print them out one after the other.

-br

#### Mohamed_Aouf

#10
##### May 05, 2013, 05:02 pm
i using it in Twitter Library to send tweets consists of 2 ( Number & text)

tweet should be in char

#### Arrch

#11
##### May 05, 2013, 05:12 pm
It sounds like both issues you're having can be solved with a simple call to sprintf().

#### PaulS

#12
##### May 05, 2013, 05:20 pm
Quote
tweet should be in char

No, it isn't. The tween is an array of chars that is NULL terminated, also known as a string (which is not the same thing as a useless St\ring).

Go Up

Please enter a valid email to subscribe