sorry about not being clear
this is my driver:
Code:
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
int sreplace(char newc, char oldc, char *s);
char *strmatch(char *str, char *s);
int main(void)
{
// maxline is 1024 including '\n'
char lineA[1026];
char lineB[1026];
lineA[1025] = 'x';
lineB[1025] = 'x';
/* just need anything to fill it up, null
terminator goes there if array is full */
int i = 0;
int k = 0;
int j = 0;
while ((fgets(lineA, 1026, stdin) != NULL))
{
if (fgets(lineB, 1026, stdin) != NULL){
if ( (lineA[1025] == '\0') || (lineB[1025] == '\0'))
{
fprintf(stderr, "Error: line exceeds 1023 characters\n");
exit(-1);
}
sreplace('3', 'e', lineA);
sreplace('3', 'e', lineB);
for (i=0; lineA[i] != '\n'; i++){
printf("%c", lineA[i]);
}
printf("\n");
for (k=0; lineB[k] != '\n'; k++){
printf("%c", lineB[k]);
}
printf("\n");
}
else {
if (lineA[1025] == '\0'){
fprintf(stderr, "Error: line exceeds 1023 characters\n");
exit(-1);
}
sreplace('3', 'e', lineA);
for (j=0; lineA[j] != '\n'; j++){
printf("%c", lineA[j]);
}
printf("\n");
}
}
exit(0);
}
when i compile and run data.in (just random words that contain the letter e) into it and output it to data.out, data.out is empty