Hi, Im trying to read a binary file stored in a DSP´s memory through serial port.
The idea is that the DSP puts the data it reads in its console so i can read it using Matlab through the serial port. I am able to read plain text and numbers, but when reading the binary file I get wrong characters so the data read is not useful at all.
I´ve seen lots of different codes but none of them is any useful to me.
My code is as follows:
int cmd_file_cat(int argc, char **argv){
FILE *f=NULL;
char line[512];
if(argc==2){
f = fopen(argv[1], "r");
if(f==NULL){
cli_puts("error: file not found\n");
return 1;
}
while(fgets( line, 512, f)!=NULL){
cli_puts(line); %This line makes and fputs and a fflush
}
fclose(f);
cli_puts("\033[0m\n");
}
else{
cli_puts("missing file name\n");
return 1;
}