Some of the functions that are often used in C

Source: Internet
Author: User

1, sscanf

Function Prototypes:

int sscanf (const char *,const char *,...);

int sscanf (const char *buffer,const char *format,[argument] ...);

Buffer: Stored data

Format: Formatting control string

Argument: Selective setting string

SSCANF will read the data from buffer, and write the data into the argument in accordance with format.

Header file:

#include <stdio.h>

return value:

Success returns the number of arguments, and failure returns-1.

Example:

#include <stdio.h>intMain () {Charn[4]; printf ("%d", SSCANF ("DFSAD;SFASDF","%c%c%c", &n[0],&n[1],&n[2])); printf ("\ n-------------------\ n");  for(intI=0;i<4; i++) {printf ("%c\n", N[i]); }    return 0;}

Output Result:

3-------------------dfs

  

Some of the functions that are often used in C

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.