home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The C Users' Group Library 1994 August
/
wc-cdrom-cusersgrouplibrary-1994-08.iso
/
listings
/
v_10_11
/
1011118a
< prev
next >
Wrap
Text File
|
1992-09-14
|
450b
|
34 lines
/* concat.c: Paste input strings together */
#include <stdio.h>
#include <string.h>
#define WIDTH 80
#define WRDSIZ 15
main()
{
char buf[WIDTH+1], word[WRDSIZ+1];
int n = 0;
while (gets(word))
{
if (n + strlen(word) > WIDTH)
break;
n += sprintf(buf+n,"%s",word);
puts(buf);
}
return 0;
}
Input:
one
two
three
Output:
one
onetwo
onetwothree