From 11b16a12c09e5fd2502c4dae6f0d2277d26a27ff Mon Sep 17 00:00:00 2001 From: Alan Johnston Date: Tue, 2 Oct 2018 15:27:01 -0400 Subject: [PATCH] parsing of mopower status string --- cw/cw_main.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/cw/cw_main.c b/cw/cw_main.c index cd77df43..ef28d80e 100644 --- a/cw/cw_main.c +++ b/cw/cw_main.c @@ -86,7 +86,25 @@ int main(void) fgets(cmdbuffer, 1000, file); pclose(file); printf("buffer is :%s\n", cmdbuffer); - + + char mopower[64][14]; + + +// char str[] ="- This, a sample string."; + char * pch; +// printf ("Splitting string \"%s\" into tokens:\n",str); +// pch = strtok (str," "); + int i = 0; + pch = strtok (cmdbuffer," ,.-"); + while (pch != NULL) + { + strcpy(mopower[i], pch); + printf ("mopwer[%d]=%s\n",i,mopower[i]); // pch); + pch = strtok (NULL, " "); + i++; + } + printf("Battery voltage = %s\n", mopower[16]); + while(1) { // loop forever for (channel = 0; channel < 7; channel++) {