beautypg.com

Sscanf, Strcat, Sscanf strcat – Zilog Z8F0130 User Manual

Page 488

background image

Appendix B. C Standard Library

UM013037-1212

464

Zilog Developer Studio II – Z8 Encore!
User Manual

Example

int i;

srand(1001);

i=rand();

sscanf

Reads formatted data from a string.

Synopsis

#include

int sscanf(char *s, char *format, ...);

Returns

The value of the macro EOF if an input failure occurs before any conversion. Otherwise,
the

sscanf

function returns the number of input items assigned, which can be fewer than

provided for, or even zero, in the event of an early conflict between an input character and
the format.

Example

char buf [80];

int i;

sscanf(buf,"&d",&i);

strcat

Appends a copy of the string pointed to by s2 (including the terminating null character) to
the end of the string pointed to by s1. The initial character of s2 overwrites the null charac-
ter at the end of s1.

Synopsis

#include

char *strcat(char *s1, char *s2);

Returns

The value of s1.

Example

char *ptr;

char s1[80]="Production";

char s2[]="Languages";

ptr=strcat(s1,s2);