ltom2000
May 6th, 1999, 03:24 PM
In an "Old C" code, I saw two functions:
outp(base+DATA,*buf++ & 0xFF);
write(base,buf,len);
where the declaration is extern int base; char *buf; int len; and #define DATA 0.
Questions: are those two functions outp() and write() library functions of C? Thanks.
davidramsey
May 8th, 1999, 11:57 AM
These both come from Borland 4.52 help. I hope this is what you are looking for
outp
------
Syntax
#include <conio.h>
int outp(unsigned portid, int value);
Description
Outputs a byte to a hardware port.
outp is a macro that writes the low byte of value to the output port specified by portid.
If outp is called when conio.h has been included, it will be treated as a macro that expands to inline code. If you don't include conio.h, or if you do include conio.h and #undef the macro outp, you'll get the outp function.
Return Value
outp returns value.
write
-------
Syntax
#include <io.h>
int write(int handle, void *buf, unsigned len);
Description
Writes to a file.
write writes a buffer of data to the file or device named by the given handle. handle is a file handle obtained from a creat, open, dup, or dup2 call.
This function attempts to write len bytes from the buffer pointed to by buf to the file associated with handle. Except when write is used to write to a text file, the number of bytes written to the file will be no more than the number requested. The maximum number of bytes that write can write is UINT_MAX -1, because UINT_MAX is the same as -1, which is the error return indicator for write. On text files, when write sees a linefeed (LF) character, it outputs a CR/LF pair. UINT_MAX is defined in limits.h.
If the number of bytes actually written is less than that requested, the condition should be considered an error and probably indicates a full disk. For disks or disk files, writing always proceeds from the current file pointer. For devices, bytes are sent directly to the device. For files opened with the O_APPEND option, the file pointer is positioned to EOF by write before writing the data.
Return Value
write returns the number of bytes written. A write to a text file does not count generated carriage returns. In case of error, write returns -1 and sets the global variable errno to one of the following values:
EACCES Permission denied
EBADF Bad file number
TKE Dave
ltom2000
May 10th, 1999, 11:00 AM
Thanks for the reply. It helps!
May I ask you whether I can get free Borland 4.52 software from the internet? Thanks again.
davidramsey
May 10th, 1999, 06:17 PM
I am not sure about getting the compiler freeware since I have never tried. My first thought is that you will probably have a tough time. I work as a software developer so I got the compilers and the IDE from work.
Good Luck
TKE Dave
shellreef
May 10th, 1999, 06:39 PM
i.am/qbfiles might have Borland C++