Results 1 to 5 of 5

Thread: Implementation of vprintf() : C

  1. #1
    Join Date
    Dec 2009
    Posts
    27

    Implementation of vprintf() : C

    Hello, I am student of the Bsc(Computer Science). I have the knowledge of the C language. I have the C programming language in the syllabus. I have the knowledge about C language. But I did not much in detail about the C language. I have to submit the assignment on vprintf() function as suggested by the professor. I know about the printf() function. But I did not know about the vprintf() function. So, I want to know what is vprintf() function, How can they be used in the program, and what is the difference between the vprintf() and printf() functions. Can anyone know about the vprintf() function.

  2. #2
    Join Date
    Apr 2008
    Posts
    1,948

    Implementation of vprintf()

    Using an argument list, This vprintf() function sends formatted output to stdio. The vprintf() function is the same as the printf() function except that vprintf() function prints a number of values from a variable argument list. I think It is good enough for you to know about the vprintf() function. The following is the syntax of the vprintf() function :
    #include <stdio.h>
    #include <stdarg.h>
    int vprintf( const char *frmt, v_lst arg );

  3. #3
    Join Date
    Jan 2008
    Posts
    1,521

    Re: Implementation of vprintf() : C

    I think you know at least about the Library functions of C language. Under control of the argument format, this vprintf() function writes output to the file stdout. The format string is described under the description of the printf() function. With the variable argument list replaced with arg, this vprintf() function can be an equivalent to the printf() function that which has been initialized by the va_start() macro. This vprintf() function returns the number of characters or a negative value if there is output an error occurred. The errno indicates that the error is detected, If an error occurs.

  4. #4
    Join Date
    Feb 2008
    Posts
    1,852

    Program : Implementation of vprintf()

    The following shows the use of vprintf() in a general error message routine:
    #include <stdio.h>
    #include <stdarg.h>
    void ermg( char *frmt, ... )
    {
    v_lst arglst;

    printf( "Error: " );
    v_start( arglst, frmt );
    vprintf( frmt, arglst );
    v_end( arglst );
    }
    void main()
    {
    ermg( "%s %d %s", "Failed", 100, "times" );
    }

  5. #5
    Join Date
    Oct 2005
    Posts
    2,393

    Implementation of vprintf() : C

    There is another one more example of vprintf() function :
    #include <stdarg.h>
    #undef OPTIMIZE
    #include <crtdll/stdio.h>
    #include <crtdll/wchar.h>
    #undef vprintf
    #undef vwprintf
    int vprintf (frmt, ag)
    const char *frmt;
    v_lst ag;
    {
    int rt = vfprintf (stdout, frmt, ag);
    fflush(stdout);
    return rt;
    }

Similar Threads

  1. Implementation of mkfifo() : C
    By Garett in forum Software Development
    Replies: 4
    Last Post: 02-02-2010, 07:27 PM
  2. Implementation of mkdir() : C
    By Agustíne in forum Software Development
    Replies: 4
    Last Post: 02-02-2010, 06:16 PM
  3. C : Implementation of sin(),pow(),sqrt()
    By Adolfa in forum Software Development
    Replies: 4
    Last Post: 30-01-2010, 12:41 PM
  4. Implementation of vsprintf() : C
    By Gaelic in forum Software Development
    Replies: 4
    Last Post: 28-01-2010, 11:28 AM
  5. Implementation of mysql
    By Aloke in forum Software Development
    Replies: 5
    Last Post: 23-01-2010, 01:26 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,714,285,731.28420 seconds with 17 queries