Hi
Lets say I have an array numbers that contains the following values:
int numbers = [12, 511, 337, 254];
Now, I would like to scale those numbers into single byte values and store them in a char array
char numbersscaled;
for(i=0; i<4; i++) {
numbersscaled[i] = numbers[i]/2;
}
Finally, I would like to write those values as a binary file as follows:
filebin = fopen("results.bin", "wb");
if(file==NULL) {
printf("Error\n");
return 1;
}
fwrite(numbersscaled, sizeof(numbersscaled[0]),
numbersscaled/numbersscaled[0], filebin);
fclose(filebin);
Unfortunately, when trying to compile this program gcc does not like the fwrite command:
error: invalid operands to binary / (have ‘char *’ and ‘int’)
Anyone an idea what I am missing? Thanks!