delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/06/05/05:55:00

Message-ID: <F6E7432DD437D511AD92009027C3AAC47A813D@headoffice.umgeni.co.za>
From: Scott Sinclair <scott DOT sinclair AT umgeni DOT co DOT za>
To: djgpp AT delorie DOT com
Subject: RHIDE debugger bug
Date: Tue, 5 Jun 2001 12:10:53 +0200
MIME-Version: 1.0
X-Mailer: Internet Mail Service (5.5.2653.19)
Reply-To: djgpp AT delorie DOT com

Hi

This is a bug report for RHIDE Version 1.4.7.8 (Nov 10 2000 21:25:40)
I am running MS-DOS 5.0

Important environment variables:
PATH=C:\WINNT\system32;C:\WINNT;C:\WINNT\System32\WBEM;C:\DJGPP\BIN
DJGPP=C:\DJGPP\DJGPP.env
DJDIR=c:/djgpp
LFN=y
INFOPATH=c:/djgpp/info;c:/djgpp/gnu/emacs/info
LOCALEDIR=
LANGUAGE=
SHELL=
COMSPEC=C:\WINNT\SYSTEM32\COMMAND.COM
DJSYSFLAGS=



My problem is the following:
============================


I am running RHIDE in a windows NT DOS window.
When running the debugger on a program using fopen(), it seems that fopen()
of readonly files will only return NULL. The file "in.txt" exists in the
same directory as the application and has not been held onto by any Windows
apps.

Consider the following code:

/* bug?.c
   Test fopen() ???? */

#include <stdio.h>

int main()
{
  FILE *file_ptr_read;
  FILE *file_ptr_write;

  file_ptr_read = fopen( "in.txt", "r" );
  printf("fopen() allocated the readonly pointer %d\n\n", file_ptr_read);
  fclose(file_ptr_read);

  file_ptr_write = fopen( "out.txt", "w" );
  printf("fopen() allocated the writeonly pointer %d\n\n", file_ptr_write);
  fclose(file_ptr_write);

  exit(0);
}

When this code is compiled and run, it does what is expected. The output is
"""""
fopen() allocated the readonly pointer 590148

fopen() allocated the writeonly pointer 590148

"""""

However when a breakpoint is inserted the code returns the following
"""""
fopen() allocated the readonly pointer 0

fopen() allocated the writeonly pointer 590148

"""""

===============================
Anybody with a solution/work around so that I can debug my own code [it
relies on reading the file !!] ?:)

Thanks
Scott

- Raw text -


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