Thread: printf and putchar

  1. #1
    Registered User
    Join Date
    Feb 2003
    Posts
    4

    printf and putchar

    Hi, can anyone tell me where I can see the function definitons of functions declared in stdio.h like printf() and putchar()? I am curious as to how these functions actually work.

    Thanks!

  2. #2
    Registered User
    Join Date
    Feb 2003
    Posts
    33
    here are a few

    islower - find out if the argument is lowecase
    isupper - finds if argument is upper
    isdigit - finds if argument is digit
    isalpha - fins if argument is a letter
    isalnum - find wether its upper, lower, or a number
    isxdigit - finds if argument is hexadeciaml
    toupper- makes a char upper
    tolower - makes a char lowercase
    isspace - finds if charector is a white space (space, tab, enter and so on)
    ispunct - finds if it is puncuation
    isprint - finds it argument is any printing character
    isgraph finds if it is a printing character other then a space
    atof - converts argument to a double
    atoi - converts argument to int
    atol - converts argument to a long
    gets - reads character from keyboard into variable
    putchar - prints a single char
    getchar - reads in a single char
    puts - prints a string of char's
    sprintf - same as printf for arrays
    strcpy - copies its second argument into first argument
    strcat - adds second argument to the end of the first argument
    strcmp - compares first string to 2nd
    strchr - searchs for first occurrence of a sharacter in a string


    there are assloads of them, if this is the type of thing you are looking for, if not, sorry ;-)

  3. #3
    Registered User
    Join Date
    Feb 2003
    Posts
    4
    thanks, but actually I meant I wanted to know what the contents of the function definitions are...i.e-

    printf() {




    }

    I would like to know what is inside the {}.

    :-)

  4. #4
    Registered User
    Join Date
    Feb 2003
    Posts
    33
    oooh, cant help ya there sorry

  5. #5
    Registered User
    Join Date
    Jan 2002
    Posts
    387
    From the Visual C++ CRT Source Files:

    Code:
    /***
    *int printf(format, ...) - print formatted data
    *
    *Purpose:
    *       Prints formatted data on stdout using the format string to
    *       format data and getting as many arguments as called for
    *       Uses temporary buffering to improve efficiency.
    *       _output does the real work here
    *
    *Entry:
    *       char *format - format string to control data format/number of arguments
    *       followed by list of arguments, number and type controlled by
    *       format string
    *
    *Exit:
    *       returns number of characters printed
    *
    *Exceptions:
    *
    *******************************************************************************/
    
    int __cdecl printf (
            const char *format,
            ...
            )
    /*
     * stdout 'PRINT', 'F'ormatted
     */
    {
            va_list arglist;
            int buffing;
            int retval;
    
            va_start(arglist, format);
    
            _ASSERTE(format != NULL);
    
            _lock_str2(1, stdout);
    
            buffing = _stbuf(stdout);
    
            retval = _output(stdout,format,arglist);
    
            _ftbuf(buffing, stdout);
    
            _unlock_str2(1, stdout);
    
            return(retval);
    }
    "There are three kinds of people in the world...
    Those that can count and those that can't."

  6. #6
    Registered User
    Join Date
    Nov 2002
    Posts
    24
    Hi,

    islower - find out if the argument is lowecase
    isupper - finds if argument is upper
    isdigit - finds if argument is digit
    isalpha - fins if argument is a letter
    isalnum - find wether its upper, lower, or a number
    isxdigit - finds if argument is hexadeciaml
    arent these declared in ctype.h ?
    according to my reference they are.... http://www-ccs.ucsd.edu/c/

    it just came to my mind

    encrypted

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Calculator using getchar, putchar
    By arlen20002000 in forum C Programming
    Replies: 5
    Last Post: 03-26-2008, 10:37 AM
  2. help with using printf()
    By jcasale in forum C Programming
    Replies: 12
    Last Post: 02-09-2005, 05:50 PM
  3. %s, %20s,%-20s
    By zp523444 in forum C Programming
    Replies: 2
    Last Post: 03-20-2004, 02:22 PM
  4. trunc function
    By darfader in forum C Programming
    Replies: 8
    Last Post: 10-21-2003, 02:14 AM
  5. formatted output
    By Magica in forum C Programming
    Replies: 3
    Last Post: 05-11-2003, 11:36 PM