home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Microsoft Programmer's Library 1.3
/
Microsoft-Programers-Library-v1.3.iso
/
sampcode
/
prof_c
/
util
/
string.c
< prev
next >
Encoding:
Amiga
Atari
Commodore
DOS
FM Towns/JPY
Macintosh
Macintosh JP
NeXTSTEP
RISC OS/Acorn
UTF-8
Wrap
C/C++ Source or Header
|
1988-08-11
|
346 b
|
24 lines
/*
* string -- emit a sequence of n repetitions of the
* character ch
*/
#include <stdio.h>
#include <stdlib.h>
int
string(n, ch, fp)
int n;
char ch;
FILE *fp;
{
register int i;
for (i = 0; i < n; ++i)
if (fputc(ch, fp) == EOF && ferror(fp))
break;
/* return number of actual repetitions */
return (i);
}