[comp.lang.c] Some questions about Turbo C.

sbanner1@uvicctr.UUCP (S. John Banner) (06/22/87)

Hello,

   I got my copy of Turbo C a few days ago, and generally I like it.
However, I am having a few problems, and I was wondering if anyone else
might have seen, or heard about anything like them.

   First, I am recompiling less (the standard UNIX version, as opposed
to the PC version, but with some mods to one file to use the PC raw mode
stuff that appeared on the net earlyer this year).  The version compiled
fine with MSC4.0, but Turbo C gives me syntax errors.

.
.
.

/*
 * The type of signal handler functions.
 * Usually int, although it should be void.
 */
typedef	int		HANDLER;

/*
 * "sigs" contains bits indicating signals which need to be processed.
 */
public int sigs;
#define	S_INTERRUPT	01
#ifdef SIGTSTP
#define	S_STOP		02
#endif

extern int reading;
extern char *first_cmd;
extern jmp_buf main_loop;

/*
 * Interrupt signal handler.
 */

/*Error signal.c 41: Declaration syntax error*/
	static HANDLER
interrupt()
{
/*Error signal.c 43: Expression syntax*/
	SIGNAL(SIGINT, interrupt);
	sigs |= S_INTERRUPT;
	if (reading)
		psignals();
}

.
.
.


/*
 * Set up the signal handlers.
 */
	public void
init_signals()
{
/*Error signal.c 69: Expression syntax in function init_signals*/
	(void) SIGNAL(SIGINT, interrupt);
#ifdef SIGTSTP
	(void) SIGNAL(SIGTSTP, stop);
#endif
}

.
.
.

The error messages are on the lines above the lines to which they refer,
and there is a header file with the line
#define	SIGNAL(sig, func)	ssignal(sig, func)

I think that that is all the relevent information, feel free to ask for
more if you wish.

   The other problem I am having, is bothering me even more.  I have
this program that reads some stuff from a binary file.  I use fopen
to open the file, fgetc to read the file (I was using fread, but I
got the same results, and fgetc simplifies things).  I am using the
large memory model (I got the same results with the huge model), and
the "-1" flag (though again it does the same thing with the flag left
out).  What happens, is that if I just run the program, it totally locks
the machine (sometimes it will reboot the machine, and sometimes write
colorfull garbage on the screen, but usually just lock [to the extent
that the little red button on the back is required]) on the read.  I
have determined exactly where it is stopping by putting puts statements
on either side of the call, though if I watch what is happening with
codeview, it passes right through the statement, doing exactly the right
thing.  I also do a fseek(512, SET_SEEK) just after I open the file, but
all the calls return successfully.  I am using a static variable to hold
the FILE pointer, as the open is in a different function from the
function which does the read, and they are both in a different file from
the function that calls the two functions that deal with the file (the
var is declared as "static FILE *variable", and is outside the scope of
all the functions in the file).
  I think that pretty much describes the problem, I have tried running
the program both with, and without my standard memory resident software
(booting off of a standard DOS 3.3 floppy, or my harddrive with 3.1 made
no difference), and I am getting severly frustrated.

           I thank everyone in advance for all thier help,

                      S. John Banner

...!uw-beaver!uvicctr!sol!sbanner1
...!ubc-vision!uvicctr!sol!sbanner1
ccsjb@uvvm
sbanner1@sol.UVIC.CDN