beautypg.com

Srand, Sscanf, Strcat – Zilog EZ80F916 User Manual

Page 384: Srand sscanf strcat

background image

UM014423-0607

C Standard Library

ZiLOG Developer Studio II

eZ80Acclaim!

®

User Manual

364

srand

Uses the argument as a seed for a new sequence of pseudorandom numbers to be returned
by subsequent calls to

rand

. If

srand

is then called with the same seed value, the

sequence of pseudorandom numbers is repeated. If

rand

is called before any calls to

srand

have been made, the same sequence is generated as when

srand

is first called with

a seed value of 1.

Synopsis

#include
void srand(unsigned int seed);

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.

This manual is related to the following products: