Note that there are some explanatory texts on larger screens.

plurals
  1. POError in passing data into struct
    primarykey
    data
    text
    <p>I'm getting an error on a struct call inside a function. In the code, I am converting two bytes of data into one 16-bit data and I want to store it into one of my struct variables. However, I am getting an error that I can't pinpoint. The compiler is telling me that the error is in the line <code>unsigned int fat.sector_size = combinedBytes;</code>. What am I doing wrong here? Thanks in advance! </p> <p>EDIT: The error that I'm getting is </p> <pre><code>main.c:62:19: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘.’ token main.c:62:19: error: expected expression before ‘.’ token` </code></pre> <p><br></p> <pre><code>struct fileSystem_info{ unsigned int sector_size; //Sector size int cluster_size_in_sectors; //Cluster size in sectors int entries_in_root_directory; //Number of entries in root directory int sectors_per_fat; //Sectors per file allocation table int reserved_sectors; //Number of reserved sectors on the disk int hidden_sectors; //Number of hidden sectors on the disk int sector_number_of_first_copy_of_fat; //Sector number of the first copy of the file allocation table int sector_number_of_first_sector_of_root_directory; //Sector number of the first sector of the root directory int sector_numner_of_first_sector_of_first_usable_data_cluster; //Sector number of the first sector of the first usable data cluster }; //Converts two 8 bit data to one 16 bit data unsigned converter(unsigned mostSignificant_bit, unsigned leastSignificant_bit){ uint16_t value = (uint16_t)(mostSignificant_bit &lt;&lt; 8) | leastSignificant_bit; //return((mostSignificant_bit * 256) + leastSignificant_bit); return (value); } unsigned int sectorSize (){ struct fileSystem_info fat; unsigned char first_byte = buffer[11]; printf("%hhu \n", first_byte); unsigned char second_byte = buffer[12]; printf("%hhu \n", second_byte); unsigned int combinedBytes = converter ((int)second_byte, (int)first_byte); unsigned int fat.sector_size = combinedBytes; return (combinedBytes); } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload