the_Diabologic
Member
i'm really stuck because my sucking C-knowledge with this atm,
i need a file-loader for my 3d-engine so you can dynamically load an object (the file-format is not really complete yet, but nevermind ^^) and one for my basic-interpreter
using mirko's sdk, i can load the whole file into ram and ouput it, looks like this:
i need a file-loader for my 3d-engine so you can dynamically load an object (the file-format is not really complete yet, but nevermind ^^) and one for my basic-interpreter
using mirko's sdk, i can load the whole file into ram and ouput it, looks like this:
Code:
void load(char *file)
{
..GPFILE *file2;
..int size;
..char *filebuf;
..file2=smc_fopen(file,"r");
..size=smc_filesize(file2);
..smc_fread(filebuf, size, 1, file2);
..gp_drawString(10,164,35,filebuf,0xFFFF,fb[0]);
...//outputs the first 35 chars, i know
..while(1);
...//stops the thing here, i know
}
an example-file to load would look like this:
d(1,1,1);
f(3,3,3)(6,6,6)(9,9,9);
f(3,3,3)(6,6,6)(12,12,12);
no comments on the file-format please, i'm working at it and no i won't use any standard-format
so, for a file-loader i'd go like
1) loading first line into another variable
2) split it up and interpret it
3) next line..
now my problem is that i can't figure how to find the 1. line-end (character 13 as far as i can remember)
neither do i know how to directly put chr13 into a char (in basic it would be a$=chr$(13)) for a comparision
so, anyone could help me improve this and not just moan to read a darn C-tutorial what i have done, trying string.h-functions without success?
would appreciate it :D
Edit: .. instead of spaces -_-