how to sscanf this case.# Unix - 噫吁兮,危乎高哉
h*o
1 楼
I want to have a input string parsed by sscanf (or other function which
can work) using solaris C language 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,
can work) using solaris C language 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,