由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - how to sscanf this case.
相关主题
c++ 中如何把str转换为float?How to Parsing function in haskell?
double转换int的问题parsing bibliography and sorting (转载)
Truncation error import csv file to SQL table (转载)问java api的问题
问sscanfparsing file in node: js or python ?
问个C/C++题目请教一个parser的问题
sscanf problem in MSVC 7How to get local hostname under linux?
一个c语言的问题一道bit operator面试题
求助,这样从c++输入窗口读入一连串的单词或数字呢?stl的map可以嵌套几层?
相关话题的讨论汇总
话题: sscanf话题: 10bytes话题: string话题: parse话题: case
进入Programming版参与讨论
1 (共1页)
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

1 (共1页)
进入Programming版参与讨论
相关主题
stl的map可以嵌套几层?问个C/C++题目
perl sprintf question converting dec to hexsscanf problem in MSVC 7
有没有java大牛改过class文件?一个c语言的问题
cassandra query speed求助求助,这样从c++输入窗口读入一连串的单词或数字呢?
c++ 中如何把str转换为float?How to Parsing function in haskell?
double转换int的问题parsing bibliography and sorting (转载)
Truncation error import csv file to SQL table (转载)问java api的问题
问sscanfparsing file in node: js or python ?
相关话题的讨论汇总
话题: sscanf话题: 10bytes话题: string话题: parse话题: case