Dear Board
I’m using STM32F103 controller, when I use strstr function for finding a word in a string the compiler throws a warning. No issue for me but the code works fine
But when I use strops(), the compiler throws error. It says this is used for C199 etc.. where can I see the string functions supported for MDK-IDE??
Below is the code im trying to execute for which IDE throws error
This code is extracted from keil reference book and applied for MDK according to my usage #include <string.h> #include <stdio.h> /* for printf */ void tst_strcat (void) { unsigned char buf [21]; unsigned char s [] = "Test String"; strcpy (buf, s); strcat (buf, " #2"); printf ("new string is %s\n", buf); }
sorry.. above copied code is incorrect..
please use the below mentioned code.
#include <string.h> #include <stdio.h> /* for printf */ void tst_strrpos (const char *s) { int i; i = strrpos (s, ' '); if (i == -1) printf ("No spaces found in %s\n", s); else printf ("Last space in %s is at offset %d\n", s, i); }
Don't you think that it would be necessary for us to know what warning, exactly, the compiler "throws" in order to be able to help you with it?
Yes.. i thought it.. but i felt like it is common problem that someone could already came across.
here is what im receiving during coding : Warning : implicet declaration of function 'strpos' is invalid in C99
after compiling the error is UART\UART.axf: Error: L6218E: Undefined symbol strpos (referred from main.o). Not enough information to list image symbols. Finished: 1 information, 0 warning and 1 error messages. "UART\UART.axf" - 1 Error(s), 4 Warning(s).
Your presentation so far has been extremely confused. You can't even seem to agree with yourself what the function you're looking for is actually called: strops, strpos or strrpos.
That doesn't even matter, though, because none of those functions exists outside your imagination.
Is "google first, then post a question somewhere, and only if none of that works, one may possibly have to summon all one's courage and actually read some documentation" really the only approach to learning people know these days?
strpos(), or whatever, is not a standard library function www.cplusplus.com/.../
In uV4 the include file is here C:\Keil\ARM\RV31\INC\string.h
I'd imagine you you right click into it via the project dependencies too.
You could use grep or some equivalent
When a specific function is not supported by one tool-chain, I tend to add the function into my own source, and selectively compile it in.
Hello.
Yes strpos() is not available in string.h. i have found it by right clicking and reading supported funcitons.
i have wrote my own code to find it finally.
Thank you