[Solved] How can i read characters from a file and split it into two 16bits? [closed]


You probably want this:

u64 text[2] ;

FILE *input = fopen("myfile.data", "r") ;

if (input == NULL)
{
  printf ("Unable to open file\n") ;
  return 1 ;
}

while (!feof(input))
{
  int charsread ;
  charsread = fread(text, 16, 1, input) ;  // read at most 16 bytes into the text array  

  // process your text array here
  // charsread contains the number of characters actually read
  //     this can be less than 16 if the total file length is not a 
  //     multiple of 16. You mus deal with that.

} 

fclose(input) ;

6

solved How can i read characters from a file and split it into two 16bits? [closed]