|
-
Mar 4th, 2002, 02:23 PM
#1
Thread Starter
Addicted Member
Strings, integers, and hex oh my!
I have an imbedded controller (Rabbit 2000) that is programmed in a modified form of C, but I think much of the "basics" are the same. I have to send commands to a device in hex. The following...
Code:
char *run;
run = "\x55\x03\x10";
serBputs(run); //sends data out the serial port
...starts my device. But I want to be able to vary the last value. I've tried several things, creating another string without the last value, setting an integer to say "100", converting that to a string and combining them. This works on a fundamental level, but the "100" doesn't get converted to hex, it thinks it's a string.
So what I want is:
Code:
char *run;
int i; // i can vary from 1-255
run = "\x55\x03\x(i)" // this is not legal
How can I accomplish this?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|