Mail Archives: djgpp/1996/04/27/13:10:17
> [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 -