Thank you for your answer! I will try to do that. My struct has 4 char arrays (array1[20]...) and 1 int, no pointers or anything.
Type: Posts; User: 574515
Thank you for your answer! I will try to do that. My struct has 4 char arrays (array1[20]...) and 1 int, no pointers or anything.
Thank you for your help! I've done that and now I get error "stream.valid()" when trying to read. Read code:
FILE* open_F = NULL;open_F = fopen("myfile.bin", "rb");
if (open_F == NULL) {
...
Thank you, I've corrected that, but my original error still persists. I need to write a number of members in a file, overall number, not 1st, 2nd etc. If file doesn't exist I need to make a new file...
This is checking if file exists, if not, creating and writing 1 (as in 1st member) at the beginning (or so I thought).
int x = 1;
FILE* open_F = NULL;
open_F = fopen("myfile.bin",...
Hello,
thank you for your resposne. Fwrite() for me writes (and fread() reads) something random (like 8k+ something or -8k something).
Hello,
I've got an assignment to write a program that keeps track of a library (small one, nothing too great or polished) and to be saved as binary. I have a struct for members, and entering /...
Hello,
I have seen people writing / rewriting some predefined or "included" functions and I need to make one similar to getchar() but instead of [enter] it takes [space]. Was looking around internet...
Thank you very much for your response. I will look into it. I'm still trying to advance, since my classes are going "slower" and I'm reading books about C and trying to find online "problems" to...
I quoted a problem. I said that I've done first part with input n and printing it out. I've just put "logic" that I was thinking so far about counting consonants in days. It's easier for me to make...
I've found a "problem" online. Text goes:
I had no problem with first part, but the last is one that bothers me. If I initialize an array of 7 elements (days) how do I check for number of...
I've tried changing it and it was as Salem said. Well, I'm still learning, and our courses are going slowly. We haven't had any proper assignments yet, so I'm "winging" it on my own. Thank you for...
No, I did not. I haven't gotten any errors. I'm using Visual Studio 2019. And I do check for errors and warning messages. The only warning message I got was that types differ, since fopen returns int...
Found the solution! Thank you for taking your time and looking here!
if (fCreate = fopen(e_F_Name, "r") == NULL) {
printf("File with given name already exists.\n");
system("pause");
...
STURCT:
typedef struct date_Of_Birth {
short int day;
short int month;
short int year;
}DATE;
typedef struct student {
int pin;
Hello,
I'm trying to write a program for my assignment. I'm using STRUCTS and fprintf for writing in a file. Problem: I have main screen with choices, like, create (text file with student info),...