if (f == NULL) { perror(fname); return; } do { if (fgets(text_row, 255, f) != 0) { text_row[strlen(text_row) - 1] = '\r'; text_ptr = strchr(text_row, '$'); if (text_ptr != NULL) { strcpy(buf, text_ptr + 2); switch (*(text_ptr + 1)) { case 'c': { strcpy(text_ptr, caller); strcat(text_ptr, buf); }
if (f == NULL) { perror(fname); return; } do { if (fgets(text_row, 255, f) != 0) { text_row[strlen(text_row) - 1] = '\r'; text_ptr = strchr(text_row, '$'); if (text_ptr != NULL) { strcpy(buf, text_ptr + 2); switch (*(text_ptr + 1)) { case 'c': { strcpy(text_ptr, caller); strcat(text_ptr, buf); } } } write(fd, text_row, strlen(text_row));
void writemsg(char fname[], char caller[]){    char text_row[255];    char *text_ptr;    char buf[255];    FILE *f = fopen(fname, "r");    if (f == NULL) {	perror(fname);	return;    }    do {	if (fgets(text_row, 255, f) != 0) {	    text_row[strlen(text_row) - 1] = '\r';	    text_ptr = strchr(text_row, '$');	    if (text_ptr != NULL) {		strcpy(buf, text_ptr + 2);		switch (*(text_ptr + 1)) {		case 'c':		    {			strcpy(text_ptr, caller);			strcat(text_ptr, buf);		    }		}	    }	    write(fd, text_row, strlen(text_row));	}    }    while (!feof(f));}