fix cu_sprintf cu_va_arg starting index so it does parse right arguments
This commit is contained in:
parent
fa5aa1446c
commit
3591102cd5
2 changed files with 3 additions and 3 deletions
2
string.c
2
string.c
|
|
@ -274,7 +274,7 @@ void cu_sprintf(char* dst, size_t maxLen, const char* fmt, ...)
|
|||
char* cur,*end,c;
|
||||
char numbuf[64];
|
||||
|
||||
idx = 1;
|
||||
idx = 3;
|
||||
cur = dst;
|
||||
end = dst+maxLen;
|
||||
while((c = *fmt++) && cur != end)
|
||||
|
|
|
|||
4
test.c
4
test.c
|
|
@ -179,10 +179,10 @@ int main()
|
|||
cu_sprintf(str3, 64, "hello %u world \"%s\"", 2312, "test");
|
||||
printf("cu_sprintf\t%s\n", str3);
|
||||
|
||||
const char* str4 = "test 2312";
|
||||
const char* str4 = "\"test\" 2312";
|
||||
char str5[8] = {0};
|
||||
int val5 = 0;
|
||||
cu_sscanf((char*)str4, "%s %d", str5, &val5);
|
||||
cu_sscanf((char*)str4, "\"%s\" %d", str5, &val5);
|
||||
printf("cu_sscanf\t%s\t%u\n", str5, val5);
|
||||
|
||||
cutil_exit();
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue