Implement printf()

This is a discussion on Implement printf() within the C Programming forums, part of the General Programming Boards category; how can i implement my own printf() are there any open source libraries, containing printf() implementations which i can look ...

  1. #1
    Registered User
    Join Date
    Jun 2007
    Posts
    99

    Implement printf()

    how can i implement my own printf()

    are there any open source libraries, containing printf() implementations which i can look over?

  2. #2
    Mad OnionKnight's Avatar
    Join Date
    Jan 2005
    Location
    Umeň, Sweden
    Posts
    555
    There's glibc, which is the C standard library gcc uses, but most of the code there is pretty hardcore.

  3. #3
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459
    which is also opensource, so why not go take a peak?

  4. #4
    Registered User
    Join Date
    Jun 2007
    Posts
    99
    Here, this is what i have been able to achieve

    Code:
    #include<stdarg.h>
    
    int myprintf( const char * format, ... )
    {
            int rtn = 0;
    
            va_list args;
    
            va_start( args, format );
    
            rtn = vprintf( format, args );
    
            va_end( args );
    
            return rtn;
    }
    
    main(void)
    {
        myprintf("Vaibhav %d %d", 10, 15);
        getchar();
        return(0);
    }
    any suggestions for improvements will be appreciated

  5. #5
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459
    Sounds like homework... but that seems okay.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Problems reading entered race times C
    By loopymoo26 in forum C Programming
    Replies: 12
    Last Post: 05-23-2009, 08:38 AM
  2. IF CONDITION plese help
    By birumut in forum C Programming
    Replies: 12
    Last Post: 03-06-2009, 09:48 PM
  3. Data Structure Eror
    By prominababy in forum C Programming
    Replies: 3
    Last Post: 01-06-2009, 09:35 AM
  4. error in program????
    By SpEkTrE in forum C Programming
    Replies: 5
    Last Post: 11-24-2003, 06:16 PM
  5. Drawing tables in C
    By stanoman in forum C Programming
    Replies: 5
    Last Post: 10-09-2003, 11:14 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21