源自:msdn
Example/* STRTOK.C: In this program, a loop uses strtok
* to print all the tokens (separated by commas
* or blanks) in the string named "string".
*/#include <string.h>
#include <stdio.h>char string[] = "A string\tof ,,tokens\nand some more tokens";
char seps[] = " ,\t\n";
char *token;void main( void )
{
printf( "%s\n\nTokens:\n", string );
/* Establish string and get the first token: */
token = strtok( string, seps );
while( token != NULL )
{
/* While there are tokens in "string" */
printf( " %s\n", token );
/* Get next token: */
token = strtok( NULL, seps );
}
}
Example/* STRTOK.C: In this program, a loop uses strtok
* to print all the tokens (separated by commas
* or blanks) in the string named "string".
*/#include <string.h>
#include <stdio.h>char string[] = "A string\tof ,,tokens\nand some more tokens";
char seps[] = " ,\t\n";
char *token;void main( void )
{
printf( "%s\n\nTokens:\n", string );
/* Establish string and get the first token: */
token = strtok( string, seps );
while( token != NULL )
{
/* While there are tokens in "string" */
printf( " %s\n", token );
/* Get next token: */
token = strtok( NULL, seps );
}
}
解决方案 »
- 错在哪谢谢
- 有什么方法可以保护自己应用程序的dll之类的文件不被删除!
- VC++6.0中怎么让 MSChart显示数据库中数据的曲线啊
- 图像旋转失败!
- WaitForMultipleObjects的奇怪问题
- 如何在dialog box中动态生成CCheckListBox?
- 怎么判断给定路径的文件夹是否处于打开的状态亚!谢谢!
- 如何添加视图(从CTreeView派生)
- 寻求一份《WINDOWS网络编程技术》附书源码及Iphlpapi.lib和Iphlpapi.h文件(光盘上的)
- 为什么VS2010无法创建VC++项目,其他项目可以创建,急急急!!!
- 大家有谁知道连连看游戏中相同模块消除后画线怎么檫掉啊?
- 串口通信问题
--------------------------------
那么最大的行数是多少?
-----------------------------------
如果楼主只想使用文件,可以用fstream类来处理 之后使用fseek定位到文件
至于如何解析就简单多了吧,用楼上的strtok就可以
如果这都嫌麻烦 就直接用cin空格它就认为是下一个数了
谢谢大家了。
用 _stscanf 来解析数据
用 _stscanf 解析数据