Results 1 to 5 of 5

Thread: Implementation of vsscanf() : C

  1. #1
    Join Date
    Dec 2009
    Posts
    28

    Implementation of vsscanf() : C

    Hello, I am student of the MCA. I have the knowledge of the C language. I have to submit the assignments periodically whichever the professor suggest me. Today my professor of the C language gave me the assignment on the vsscanf() function. I know about the scanf() function. But I did not know about the vsscanf() function. So, I want to know what is vsscanf() function, How can they be used in the program, and what is the diference between the vsscanf() and scanf() functions. Can anyone know about the vsscanf() function.

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

    vsscanf() : C

    The vsscanf() function scans the text that can be formatted from the string and stores that formatted text in the variables. I think It is quit enough for you to know about the vsscanf() function. The following is the syntax of the vsscanf() function :
    #include <stdio.h>
    #include <stdarg.h>
    int vsscanf( const char *in_string, const char *format, va_list arg );

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

    Implementation of vsscanf()

    I guess you know atleast about Library function. Under control of the argument format, The vsscanf() function scans input from the string formatted by in_string. The format string can be described under the description of the scanf() function. With a variable argument list replaced with arg the vsscanf() function is equivalent to the sscanf() function, which has been initialized using the va_start() macro. End Of File is being reached when the scanning is ended by reaching the end of the input string.

  4. #4
    Join Date
    May 2008
    Posts
    2,389

    Program : Implementation of vsscanf()

    There is the program code of lines that describes you about the vsscanf() function :
    #include <stdio.h>
    #include <stdarg.h>

    void sfind( char *string, char *format, ... )
    {
    v_lst arglst;
    v_strt( aglst, frmt );
    vsscanf( string, frmt, arglst );
    v_end( arglst );
    }
    void main()
    {
    int dy, yr;
    char wkdy[10], mh[12];

    sfind( "Monday August 18 1987",
    "%s %s %d %d",
    wkdy, mh, &dy, &yr );
    printf( "\n%s, %s %d, %d\n",
    wkdy, mh, dy, yr );
    }

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

    Re: Implementation of vsscanf() : C

    Here, one more example of code of vsscanf() function :
    #include <crtdll/errno.h>
    #include <stdarg.h>
    #include <crtdll/stdio.h>
    #include <crtdll/string.h>
    #include <crtdll/internal/file.h>
    #undef vsscanf
    int vsscanf (const char *t,const char *frmt,v_lst arg)
    {
    FILE F;
    if (t == NULL)
    {
    set_errno (EINVAL);
    return -1;
    }
    memset ((void *) &F, 0, sizeof (F));
    F._flag = _IOREAD;
    F._ptr = (char *)t;
    F._base = (char *)t;
    F._bufsiz = strlen(t);
    F._cnt = F._bufsiz;
    return __vfscanf (&F, frmt, arg);
    }

Similar Threads

  1. Implementation of mkdir() : C
    By Agustíne in forum Software Development
    Replies: 4
    Last Post: 02-02-2010, 06:16 PM
  2. C : Implementation of ctime()
    By Gavyn in forum Software Development
    Replies: 4
    Last Post: 01-02-2010, 04:21 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,062,227.55134 seconds with 17 queries