dudforreal
- 116
- 0
How do you open a binary file in command in Pelles C so that it is readable?
The discussion revolves around how to open and read a binary file in Pelles C, particularly in the context of using command line operations. Participants explore issues related to file handling, specifically the readability of binary files and the functionality of a program that interacts with such files.
Participants do not reach a consensus on the best method to open and read binary files in Pelles C, and multiple competing views and uncertainties remain regarding the functionality of the code and the nature of binary files.
There are unresolved questions about the specific errors encountered when attempting to read from the binary file and the assumptions regarding the readability of binary versus flat files.
Borek said:I would check if fopen("filename","rb") is not working.
void readFleet(Car_t toRead[])
{
FILE *fFleet;
fFleet = fopen("Fleet_File.bin", "rb");
fread(toRead, 10*sizeof(Car_t), 1, fFleet);
fclose(fFleet);
}
dudforreal said:How do you open a binary file in command in Pelles C so that it is readable?
printf("1. Add a car to the fleet.\n");
printf("2. Delete last car from the fleet.\n");
printf("3. Display full fleet on the screen.\n");
printf("4. Save the fleet to a file.\n");
printf("5. Read the fleet from a file.\n");
printf("0. Exit the program\n");
printf("\nPlease enter your choice:\n\n");