-
C : What is the vscanf()
Hello, Friends. I am student of the MCA first year. I know basics of the C language. Periodically, I have to submit the assignments in college. In next week I have to submit the assignment on the vscanf() function. I have the knowledge about the scanf() function, But I do not know anything about the vscanf() function. So, I would like to know what is the vscanf() function, How they can be implement in the C program. Can anyone know about the vscanf() function.
-
C : vscanf()
I think that except the argument list replaced by a pointer to a list of arguments, vscanf() function can be functionally similar to the scanf() function. This pointer must be of type v_lst, that can be defined in the header file. The following is the syntax of the vsscanf() function :
#include <stdarg.h>
#include <stdio.h>
int vscanf( const char *frmt, v_lst arg );
-
C : vscanf()
Hi, Under control of the argument format the vscanf() function can scans input from the file that can be designated by stdin. The format of the string can be explained under the description of the scanf() function. With a variable argument list that can be replaced with arg the vscanf() function can be similar to the scanf() function, that has been initialized using the v_strt() macro. Whenever the scanning can be ended by reaching at the end of the input stream, EOF is reached.
-
Re: C : What is the vscanf()
#include <stdio.h>
#include <stdarg.h>
void find( char *frmt, ... )
{
v_lst arglst;
v_strt( arglst, frmt );
vscanf( frmt, arglst );
v_end( arglst );
}
void main()
{
int d, y;
char wekd[10], mont[12];
find( "%s %s %d %d",
wekd, mont, &d, &y );
printf( "\n%s, %s %d, %d\n",
wekd, mont, d, y);
}
-
What is the vscanf()
One more example that help's you to know about the vscanf() function :
#include <stdio.h>
#include <stdarg.h>
void get_msg(char *frmt, ...)
{
v_lst pt;
v_str(pt, frmt);
vscanf(frmt, pt);
v_end(pt);
}
int main(void)
{
int k;
printf(" INTEGER : ");
get_msg(" %d ", &k);
printf("%d", k);
return 0;
}
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
Page generated in 1,714,064,228.31793 seconds with 15 queries
Bookmarks