S
spike
I use this code to read number of characters
from a file.
The problem is: It only returns about 1500 chars.
If i open the file in a text editor it contains
almoust 3 million rows. Sure it must contain more than
1500 characters? Is it because some characters are not readable?
The file is not a textfile but a half-life demo file. (binary)
Whats the problem?
What I want to do eventually is to search for the string "/name/"
and read the string that comes after that.
Any idea?
Source code:
------------------------------------------------------
#include <stdio.h>
int main()
{
FILE *fp;
fp = fopen("demo.dem","r");
if(fp == NULL)
{
perror("Error");
}
else
{
char tkn;
int i=0;
while(!(feof(fp)))
{
tkn = getc(fp);
printf("%c",tkn);
i++;
}
printf("Found %d characters", i); // Says 1500 characters on a 5 meg file
fclose(fp);
}
return 0;
}
------------------------------------------------------
from a file.
The problem is: It only returns about 1500 chars.
If i open the file in a text editor it contains
almoust 3 million rows. Sure it must contain more than
1500 characters? Is it because some characters are not readable?
The file is not a textfile but a half-life demo file. (binary)
Whats the problem?
What I want to do eventually is to search for the string "/name/"
and read the string that comes after that.
Any idea?
Source code:
------------------------------------------------------
#include <stdio.h>
int main()
{
FILE *fp;
fp = fopen("demo.dem","r");
if(fp == NULL)
{
perror("Error");
}
else
{
char tkn;
int i=0;
while(!(feof(fp)))
{
tkn = getc(fp);
printf("%c",tkn);
i++;
}
printf("Found %d characters", i); // Says 1500 characters on a 5 meg file
fclose(fp);
}
return 0;
}
------------------------------------------------------