Token parsing

Ok.

This is what I have:

FILE* DB_handle = fopen (dbfile, "rb");

if (DB_handle!=NULL) {
char *read;
char *id;
struct _stat buf;
char token[] = "";

_fstat(_fileno(DB_handle), &buf);
read = (CHAR*)malloc(buf.st_size);

fread(read,sizeof(CHAR),1,DB_handle);

id = strtok(read,token);

while (id != NULL) {
fputs("<td>",site_handle);
fputs(id,site_handle);
fputs("</td>",site_handle);

id = strtok(NULL,token);

}

Ok, so what I'm trying to do is read a file into the memory as a CHAR, then scan that for my token, then every time it comes up, write it to an html table.(site_handle is the .html file)

It all compiles, however it's only getting 1 token, and i think I may be loading it into the CHAR wrong.
[857 byte] By [Soul_Eater] at [2007-11-19 6:15:05]
# 1 Re: Token parsing
fread(read,sizeof(CHAR),buf.st_size,DB_handle);
AdaraCD at 2007-11-9 13:14:50 >
# 2 Re: Token parsing
Hmm.

Ok now I have:

FILE* DB_handle = fopen (dbfile, "rb");

if (DB_handle!=NULL) {
char *read;
char *id;
struct _stat buf;
char token[] = "";

_fstat(_fileno(DB_handle), &buf);
read = (CHAR*)malloc(buf.st_size);

fread(read,sizeof(CHAR),buf.st_size,DB_handle);

id = strtok(read,token);

while (id != NULL) {
fputs("<td>",site_handle);
fputs(id,site_handle);
fputs("</td>",site_handle);

id = strtok(NULL,token);

}

And it just retrieves just the 1st line of data in the file, which doesnt have the token in/near it at all.
Soul_Eater at 2007-11-9 13:15:48 >
# 3 Re: Token parsing
check the return value of fread, it should be the same as buf.st_size
AdaraCD at 2007-11-9 13:16:46 >
# 4 Re: Token parsing
it is the same
Soul_Eater at 2007-11-9 13:17:52 >