Tool/software: Code Composer Studio
I want to read a binary file and store it in a matrix. But initially when I tried to read a text file and store it in other file I don't get any output. I was just trying to read a integer value from text file and store it but its not happening. I am using TM4C123. This is my code.
#include<stdio.h>
#include<stdlib.h>
int main(){
FILE *fileptr1,*fileptr2;
int bdata[5];
fileptr1 = fopen("G:/workspace/binfileread/trialfile.txt", "r");
fread(bdata,4,1,fileptr1);
fclose(fileptr1);
fileptr2=fopen("G:/workspace/binfileread/writedata.txt","w");
fprintf(fileptr2,"%d",bdata[1]);
fclose(fileptr2);
return 0;
}