hi,
well i decided that writing a GetToken function would be a much better way to parse the file:
#include <iostream>
#include <fstream>
#include <conio.h>
using namespace std;
enum TokenType {NUL,DEFORMER,COLON,VALUE};
//get token
TokenType GetToken(char *p,char token[100]) {
unsigned int index = 0;
while(*p != ' ' && *p != '\n') {
token[index] = *p;
*p++; index++;
}
token[index] = '\0';
//get token type
if(!strcmp("deformer",token)) {
//got a deformer
return DEFORMER;
}
return NUL;
}
int main() {
char *p = "deformer is me";
char token[100];
if(GetToken(p,token) == DEFORMER) {
cout << "got a deformer";
}
cout << "\n\npress a key to exit...";
while(!kbhit()) ;
return 0;
}
it works, but the problem is i dont know how I can get a pointer to the file contents?
any suggestions?
hope someone can help me out!
thx!