I'm on an MCU with extremely limited space, and I'm somehow losing my reference in C. I want the format of something like this:
int commandsubstring(char *stringaddress,char *substringaddress);
However, I did this routine in ASM because I was having some issue in C and just wanted to get it done. Now that it's done, I want to fix it. What the function does is read a SCPI command. I take the format of "MEASure:VOLTage:DC?" and then I recursively return the command. In my example, want to return the address of substring
MEASure:VOLTage:DC?
^ ^
I want to be able to do something like :
char *cmd="MEASure:VOLTage:DC?";
char *subcmd;
commandsubstring(cmd, subcmd);
printf("%s\n", cmd);
printf("%s\n", subcmd);
And then get the result of
MEASure:VOLTage:DC?
VOLTage:DC?
I'm unsure why, but I'm losing my pointer somewhere in the process. In the rest of the code, I just return structures, but due to the fact that this particular part is recursive, I wanted to try something that I felt was safer, but I just cannot seem to get the C correct and it's just a braino somewhere. Any assistance would be greatly appreciated.
Edit This is not a question about tokenization, just the proper way to correctly return a different location in the same string.