snprintf in nano-lib, when format %s with NULL, it have problem?
Asked by
XuXiaodong
Hello,
In my project, when using snprintf with nano-lib, for example:
char buff[50];
char* expr; //expr is a variable used in my code, the pointer maybe NULL or a string
snprintf(buff, 50, "the string is %s",expr);
when expr is NULL, I know in newlib, the NULL will be transported to "NULL" string, but in nano-lib the snprintf (in nano-lib) cannot work. How Can I reslove the problem? thank you very much!
Question information
- Language:
- English Edit question
- Status:
- Answered
- Assignee:
- No assignee Edit question
- Last query:
- Last reply:
Can you help with this problem?
Provide an answer of your own, or ask XuXiaodong for more information if necessary.
To post a message you must log in.