/*
* FileUtil.h
*
* Created on: 2013-7-1
* Author: frodo
*/
#ifndef FILEUTIL_H_
#define FILEUTIL_H_
#include <vector>
#include <stdio.h>
class TableRowEvent{
public:
virtual void onReadRow(int tag, int count, char** cols, int row) = 0;
};
class FileUtil {
public:
FileUtil(){ };
virtual ~FileUtil(){ };
public:
static bool readResource(int tag, const char* filename, TableRowEvent* event);
};
#endif /* FILEUTIL_H_ */
/*
* FileUtil.cpp
*
* Created on: 2013-7-1
* Author: frodo
*/
#include "FileUtil.h"
#include <string.h>
void prcessRow(int tag, char* data, size_t dataLen, int row, TableRowEvent* event){
if(dataLen == 1 && *data == '\r') {
return;
}
int cur = 0;
int titleCount = 0;
char* titleBuffer[256];
for(int i = 0 ; i < 64 ; i&