Advertisement

C语言获取文本文件中的信息

阅读量:

在MATLAB环境中,通过单条指令即可完成对txt文件数据的读取操作,而使用C语言实现相同功能则需要编写更为复杂的代码。经过多次尝试与探索,最终成功获取了所需的数据,虽然所采用的方法略显繁琐,但由于仅用于实验目的,对效率要求不高,因此暂且可以接受,后续若发现更优的解决方案再进行优化调整。

复制代码
 #include "stdafx.h"

    
 #include <stdio.h>
    
 #include <stdlib.h>
    
 #include <iostream>
    
 #include <fstream>
    
 #include <string>
    
  
    
 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[])
    
 {
    

全部评论 (0)

还没有任何评论哟~