I'm having a problem when trying to read 3 letter each time, I want to read line by line and in each line to read sequentially 3 letters at a time.
when read the line when finding the \n jumps to the next line...
i try this
while ((getline(&line, &lenght, file)) != -1){
while ((strncpy(ch, line, 3)) != NULL) {
let = replaceletter(tab, ch);
if (let != 0)
printf("%c", let);
}
}
but it does not work, just read the first 3 letters and I wanted the entire line. I really do not know how to do this, I need help, please
I don't understand how the second while loop is supposed to work. strncpy returns s1, IE ch in this case. ch had better be a char *.
So.. how is ch ever going to == NULL, unless it already was NULL to start off with? And if ch is NULL to start off with (the initialisation of it is not shown) then it's already a segfault :)
It might make sense if this line were
while(*(strncpy(ch, line, 3)) != NULL)) {
HTH