Hi.
I read correctly in MatLab some data by serial port of a device, but in C... nothing.
The message "ERRO: não consigo abrir porta COM\n" don't appear, so I haven't error there. I just do not see anything in the terminal.Code:#include <cstdlib> #include <stdio.h> int main(void) { FILE *in; char linha[30]; while(1) { // Abrir porta COM de onde se ligou a placa in = fopen( "COM8", "r" ); if( in == NULL ) { printf("ERRO: não consigo abrir porta COM\n"); exit(1); } // Ler de um ficheiro e escrever no outro while( fgets(linha, 30, in) != NULL ) { printf("%s",linha); // Mostrar no terminal } } // Fechar os ficheiros fclose( in ); return 0; }