Mail Archives: djgpp/1997/12/29/19:01:57
I wrote this little program in DJGPP, or at least I tried, but something
went wrong!!!!
This code you see here works just fine when I try to read small files,
less than 1000 bytes I think, but when I try to read bigger files it
doesn't work.
WHY!!!!!!!
Here's the code:
#include <stdio.h>
void main(arg_counter, arg_pointers)
int arg_counter;
char *arg_pointers[];
{
FILE *file_pointer;
char *file_buffer;
int file_number;
long int file_size;
unsigned char end_of_file;
char *search_word_ptr;
char *text_ptr;
long int word_match;
long int a,b,c,d;
int search_word_length;
long int mid_match;
char *e;
file_pointer = fopen(arg_pointers[1], "rb");
file_number = fileno(file_pointer);
file_size = (filelength(file_number)) + 256;
*file_buffer = malloc((file_size)+512);
fread(file_buffer, 1, file_size, file_pointer); <-------- This is were
it crashes!!!!
fclose(file_pointer);
I realy would apreciate any help....
lanton AT c2i DOT net
- Raw text -