The following knowledge points are scattered, often used in programming, make a note:
1,memset
Function prototype: void * memset (void * Dst, int Val, size_t size);
Function: Sets the value of the first size byte of the DST that has opened up the memory space to a value of Val
Such as:
memset (Header->wsa__messageid, 0, 100); Empty the contents of Header->wsa__messageid
2,strcpy
Function prototypes: extern char *strcpy (char *dest,char *src);
Function: Copies a null-terminated string referred to by SRC to the string referred to by Dest.
Such as:
strncpy (Header->wsa__messageid, _hwid, strlen (_hwid)); Copy the contents of the string _hwid into the Header->wsa__messageid string
3,sprintf
Function: String Formatting command
Such as:
sprintf (_hwid, "urn:uuid:%ud68a-1dd2-11b2-a105-%02x%02x%02x%02x%02x%02x",
Flagrand, Macaddr[0], macaddr[1], macaddr[2], macaddr[3], macaddr[4], macaddr[5]); Flagrand, Macaddr[0]~macaddr[5] Write//to string "Urn:uuid:%ud68a-1 Dd2-11b2-a105-%02x%02x%02x%02x%02x%02x ", and save it to _hwid inside
4,sscanf
Such as:
SSCANF (str, "%d.%d.%d.%d", &IIP1,&IIP2,&IIP3,&IIP4); According to the "%d.%d.%d.%d" format, the contents of STR are parsed out IIP1~IIP4
5.typedef
Role: Used to define a synonym for a type
such as: typedef double wages; Wages is a synonym for double
typedef wages Salary; Salary indirect is a synonym for double
6. Enum Enumeration
Such as:
typedef enum
{
Video_stream = 0x00; An enumeration member is a constant expression that can be used anywhere else where constant expressions are required
Audeo_stream =0x01;
Subpicture_stream = 0x02;
Unknown_stream = 0x03
Count_stream = 0x04;
} Streamtype;
Use of functions such as memset,strcpy, sprintf, etc. in C language