Read And Write An Array Of Structs To A Binary File | C Programming Example

preview_player
Показать описание
Рекомендации по теме
Комментарии
Автор

Your videos have been saving my academic life! C is very hard to understand but I find it so easy to sit through your whole videos and always come out with a better understanding, even after learning the same thing in a classroom. The examples really transfer over well to assignments I've been getting. They require some adjustment of course but that hasn't been a problem since I actually understand the code I'm writing now. Thank you!

gabrielfairbairn
Автор

Thank you so much for this video, it really helped me out in understanding how binary i/o works in C. In my personal project, I computed the gravitational interactions between n particles, which can take quite a while. Thus I wanted the ability to write the data to a binary and then later read it. This was the first tutorial I've found in a long time that has eloquently explained a topic, so seriously, thank you for this!

GameKraken
Автор

Excellent job, Kevin. I can see many uses to this Struct allocation in embedded design. Thank you very much.

fifaham
Автор

Great. But there is a need to fclose(file) even if errors happens. Then, before return false, or return NULL in the functions, we must call fclose() or, better, creating a single point of failure and goto there if an error and a single point of success if no errors.

andredcavalcante
Автор

Really nicely paced example code which was logical and didn't get bogged down with irrelevant guff. 👍

wizrom
Автор

This was amazing, this video helped me to solve all the issues in my code.

Skayllan_
Автор

This was teached really verry clear. Thank you for teaching so nice and clear. 👍

nejathakan
Автор

Okay so this works! Thanks. Though instead of char array when I use char * in Student structure, this doesn't work? I need a solution for that. How to make it work when u have a char * in your structure instead of char array?

itspurelypassionate
Автор

Hey man,
Can you please make a video on what C++ topics we should know to be able to master C++. I mean yes, it's a life-long journey and we have to keep learning, but CS students like me and other self-taught programmers might not feel comfortable applying to jobs with their current abilities. Impostor syndrom plays a big role in this, but also not knowing how much topics we should know also make us uncomfortable to apply for SW jobs.

techademy
Автор

or anything after or anytime and thanks for seeing these

ryanalnaser
Автор

didn't you forget to close file before "return false"? and also "free(school)" before "return 1"?

ForeverNils
Автор

in the line: if(fwrite(data, sizeof(Student), total, fp)!=total) return false;

it says: comparison between signed and unsigned integer expressions.

Program is working but i just wanna eradicate this warning in vscode

marbles
Автор

In the read file you almost deal with every assumed error and free the memory . But something i do not understand at the last end of the function we returned pointer to the allocated memory address and we did not free it after i do understand that if we free it that means our return pointer will not be valid no more but is that mean everytime we call this read file it will allocated new memory ? And is not freed up? Is that not memory leak ?
I am sorry if my question is looked stupid but i am trying to learn more in how the memory behave in those situations

mohamedgendia
Автор

Why on the read mode, you didnt free its allocated memory after return it ? Can we do it before return ? Im pretty sure the all the data will gone, right ? :’) is there any solution to free it ?

ngnerd
Автор

Which part of the write and read function do the writing and reading? Are they executed despite being within an if-statement?

nar
Автор

Hey man, I love your videos, I don't know if you'll ever reply but when I compiled the code of *read_data an warning appeared in my console which says: "warning: comparison between pointer and integer" any possible fix to that? Thx

juanivillanueva
Автор

whatever anything I do or know or knew or anything I did not know

ryanalnaser
welcome to shbcf.ru