gpt4 book ai didi

c - 使用 sscanf 处理文本文件中的单个配额

转载 作者:太空宇宙 更新时间:2023-11-04 07:38:44 25 4
gpt4 key购买 nike

我要拆分文本

Central & Western - Water Street,6799,660,2780,1901,2624
Wan Chai - Hennessy,6505,766,1606,2071,2725
Wan Chai - Oi Kwan,6232,737,1919,2696,2651
Wan Chai - Canal Road,7607,982,2021,2913,3083
Wan Chai - Causeway Bay,6311,819,1387,2324,3275
Wan Chai - Tai Hang,6856,899,2148,1949,2725
Wan Chai - Jardine's Lookout,6567,1103,2940,1973,2029
Wan Chai - Broadwood,6101,1397,2887,1730,2080
Wan Chai - Happy Valley,6684,881,1550,2056,2418

代码

sscanf(line_buffer, "%[^','],%d,%d,%d,%d,%d", node.district, &node.employees, &node.employers, &node.students, &node.retried, &node.others);

但在怡和,单一配额似乎打破了我的程序,如何处理?

最佳答案

只需从表达式中删除引号(不需要):

"%[^,],%d,%d,%d,%d,%d"

关于c - 使用 sscanf 处理文本文件中的单个配额,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6314404/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com