www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/04/27/13:10:17

Date: Sat, 27 Apr 1996 10:00:27 -0700 (PDT)
From: Jag <gaghon AT nevada DOT edu>
To: Samuel Vincent <svincent AT zippy DOT sonoma DOT edu>
cc: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>, djgpp AT delorie DOT com
Subject: Re: problem with DJGPP and arrays.
In-Reply-To: <Pine.SUN.3.90.960426235710.9006C-100000@zippy>
Message-ID: <Pine.OSF.3.91.960427095740.31084A-100000@pioneer.nevada.edu>
MIME-Version: 1.0


> [error message and code examples removed]
> 
> Hrm..  it sounds as if you are accessing memory with a garbage pointer..
> in other words, going outside your array...  And somehow declaring more 
> array storage gives more memory so you happen to hit memory which was 
> allocated somewhere (probably not for that particular piece of code that 
> is accessing it however...)
> 
> Could you post the contents of function read_t2?
> 

void fread_t2(char p_a, char *s_a, int l_c)    /* read x amount of bytes */
{                                          /* start_addr, string, count */
  int handle, l_a;
  handle = _open( s_a, 0);
  if (handle != -1)
  {
    l_a = _read(handle, p_a, l_c);
    _close(handle);
    if (l_a == 0)
    {       /* !@#$ add out, error and stop code */
      out();
      printf("Error reading file...\n");
    }
    else if (l_c != l_a)
    {
      out();
      printf("File size error...\n");
    }
  }
  else
  {         /* add out, error and stop code */
    out();
    printf("Error opening file...\n");
  }
}

- Raw text -


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