cvs.gedasymbols.org/archives/browse.cgi   search  
Mail Archives: djgpp/1997/12/29/19:01:57

Message-ID: <34A6E7A9.35B1E68D@usa.net>
Date: Mon, 29 Dec 1997 00:58:33 +0100
From: Rune Lanton <please DOT mail DOT me AT usa DOT net>
MIME-Version: 1.0
To: djgpp AT delorie DOT com
Subject: What's wrong????

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019