C语言读取txt文件的数据

读取txt的数据,在matlab中一条语句就可以实现,C语言中却要复杂很多。尝试了很多种方法,终于读取到了想要的数据,方法比较笨,但好在只是用来试验,可以不用在乎效率,以后看到好的方法再加以改进。

#include "stdafx.h"
#include 
#include 
#include 
#include 
#include 

using namespace std;
#define LINENUM 12783 //数据行数
struct FRAME
{
	int framenum;
	int objnum;
	int startx;
	int starty;
	int width;
	int height;
} frame[LINENUM];

int _tmain(int argc, _TCHAR* argv[])
{
	ofstream fresult("result.txt");
	int framenum;
	int objnum;
	float startx;
	float starty;
	float width;
	float height;
		
	string perline;
	ifstream input("record_target_trajectory.txt");
	for (int num=0;num


你可能感兴趣的:(C,+,OpenCV)