blob: 672a15263fdec7627f420cdcdafd63bda3aa5c4b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
#include <stdio.h>
main()
{
char Host[64];
char User[64];
char *Buff = "Jobname=job1 Hostname=arnamul User=leslim Time=11:15";
/* <----------> <-----> <---------> <-------->
* | | | |
* | ------------ | |
* | | ------------------ V
* | | | NULL
* V V V */
sscanf (Buff, "%*s Hostname=%s %s", Host, User);
printf("Host is %s\n", Host);
printf("User is %s\n", User);
exit(0);
}
/************************************************************************
*
* Job Output is:
*
* Host is arnamul
* User is User=leslim
*
************************************************************************/
|