All pastes #59039 Raw Edit

Mine

public c v1 · immutable
#59039 ·published 2006-05-26 14:29 UTC
rendered paste body
#include <stdio.h>#define MAXLEN 1000 void strcat2(char *ps, char *pt); int main(){  char t[MAXLEN];  char s[MAXLEN];  int i = 0, c;  while ((c = getchar()) != EOF) {    t[i++] = c;    /* i is now incremented, so t[i] points to the wrong place. */    if (t[i-1] == '\n') {      strcat2(s, t);      printf("%s", s);      i = 0;    }  }  return 0;}void strcat2(char *ps,  char *pt){  /* Copy up to the newline character only (inclusive). */  while ((*ps++ = *pt++) != '\n')    ;  /* The '\0' character (0), signifies the end of a string. */  *ps = '\0';}