CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    May 1999
    Posts
    4

    "Old C" functions

    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.



  2. #2
    Join Date
    May 1999
    Posts
    13

    Re: "Old C" functions

    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

  3. #3
    Join Date
    May 1999
    Posts
    4

    Re: "Old C" functions

    Thanks for the reply. It helps!

    May I ask you whether I can get free Borland 4.52 software from the internet? Thanks again.


  4. #4
    Join Date
    May 1999
    Posts
    13

    Re: "Old C" functions

    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

  5. #5
    Join Date
    May 1999
    Posts
    53

    Re: "Old C" functions

    i.am/qbfiles might have Borland C++


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured