|
-
Jun 9th, 2001, 10:16 PM
#1
Thread Starter
Hyperactive Member
Strings...
This is a long question: PLEASE continue reading.
||
||
||
\/
How do I use strings. I know you need a "char *something;" and I have included the string.h file, but I never needed to use strings.
Now what I will do is send strings via radio frequency for a network of robots to communicate with eachother in a few kilometer radius. These robots will never be this far apart, but I would like range. Anyways, these are the strings I need to decipher:
Command[Robot_Name]:function('argument1', 'argument2');
"Command" ---> This will be the key word so my program knows a command is being issued.
[Robot_Name]: ---> This is the name of the robot that will be recieving this command. Robots SHOULD ignore a command that is not issued to them. If this is left blank such as [], then the command is issued to all robots on the RF network.
function( ---> This is the name of the command that is being issued. The bracket means that the arguments are to follow.
'argument1' ---> Argument number 1. Anything that is in between the apostrophies gets assigned to a variable.
, ---> Just like in C/C++, this means that another arguement is to follow.
'arguement2' ---> Same as arguement1.
); ---> Ends function. Tells program that the PLL's(phase-lock-loop) Radio-Frequency signal is finished. Tells program that the PLL is ready to recieve the next command.
Basically, all I need to know is how I can cut up strings. I need to keep cutting up the strings like the following for example with [robot_name]:
char *roboname;
//Get the command and the first "["
while(something !="]")
{
//Do something to get the recipient robot's name. Continue
//getting characters until the character encounted is a "]"
roboname=roboname+ characters in order that were found before "]";
}
if (next char != ":")
return;
//get the robot's next command...
and so on and so forth... How would I do this!? This seems easy, yet I can't do it because I don't know how to do this stuff that is commented.
Designer/Programmer of the Comtech Operating System(CTOS)
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
|