h**o 发帖数: 548 | 1 I want to have a input string parsed by sscanf (or other function which
can work) in this way:
if the first part of the string is less than 10bytes, parse it and
assign it to a variable;
if the first part of the string is more than 10bytes, truncate it and
assign it to a variable.
Her is my expected result:
suppose input[] = "ThisStringFieldShouldBeTruncated 123
OtherStringFieldWhichAlsoShouldBeTruncated 456";
I want to parse it to
char v1[11]="ThisString"; int b1= 123, char v2[5] = "Othe", int | e*u 发帖数: 99 | 2 why not do it in two steps? it would be cleaner and easier to
understand, I think.
【在 h**o 的大作中提到】 : I want to have a input string parsed by sscanf (or other function which : can work) in this way: : if the first part of the string is less than 10bytes, parse it and : assign it to a variable; : if the first part of the string is more than 10bytes, truncate it and : assign it to a variable. : Her is my expected result: : suppose input[] = "ThisStringFieldShouldBeTruncated 123 : OtherStringFieldWhichAlsoShouldBeTruncated 456"; : I want to parse it to
|
|