C Video Tutorial 12

Get the Code & Transcription Here :

Welcome to my C Binary File IO tutorial. With the binary view of a file you have access to all the bytes in the file. You can store strings, arrays, structs, etc.

Aside from showing how to save and retrieve strings, I’ll also cover how to save array data and grab it out of the file randomly. I also briefly cover error handling in C.

All the code is available above along with a transcript of what I said for translation.






36 responses to “C Video Tutorial 12”

  1. Danilo Novaković Avatar

    Whoa I had no idea that fseek and stuff existed, I literally so far always custom-made functions that did similar jobs.

  2. Wenhao Chen Avatar

    Derek, very nice and informative video, I am curious about how can you read a binary file which includes a mix of characters and integers?

  3. Ishu Jaiswal Avatar

    Is it possible to read a binary file in string of binary ,like streams of 0's and 1's.
    your feedback will be helpful.

  4. Nirav Patel Avatar

    Thanks for explanation..
    can you please provide an example on how to update binary file in between… Like if we stored and structure in binary file, and you want to change the value of int variable in that structure thn which is the efficient way..

  5. superdupe Avatar

    Hi Derek! I have a question, how would you parse a binary file one byte at a time, then somehow change those individual bytes to integers or doubles or characters to be saved somewhere like a struct? Thanks

  6. Derek Banas Avatar

    Thank you 🙂 You write to a binary file when you want to store data like an array. You can only store regular text in a text file. I almost always write to binary files.

  7. ThinkPositive00 Avatar

    Hey Derek,
    Great videos as always. If you have time to reply I was just wondering what is the benefit of binary view of a file instead of just standardly opening it? In what situations would each be preferable? Thanks!

  8. Derek Banas Avatar

    You're very welcome 🙂 I will definitely cover more data structures

  9. rakesh verma Avatar

    thanks for gr8 lectures derek……please upload more topics on linked list such as circular linked list, priority linked list etc.

  10. Derek Banas Avatar

    Thank you 🙂 Comparing me to Billy Mays is quite a compliment! I live very close to were he grew up in McKees Rocks, Pennsylvania. I really want to make an electronics tutorial. It would be extremely fun. My C tutorial is starting to morph into that. It would be a blast to make electronics tutorials while making Android tutorials. We'll see what happens.

  11. Wayne Green Avatar

    You have a gift for presenting info that only a few people have. A person that comes to mind is Billy Mays (mins the baggage). There was a reason that companies paid him millions to sell. He was effective. I consider you to be in a similar league. I am sure you would do well presenting PLC information if you chose to do so. Another genre/niche would be the Lego Mindstorms robot hobby. Presenting it in a way that would be entertaining for children, adolescents, and adults alike. Just a thought

  12. Derek Banas Avatar

    Thank you for the compliment 🙂 C allows you to directly work with the hardware in a computer and as you'll see it can be used to program electronics. Knowing C is also very useful for making games. I originally bought a Mac for the free video apps like iMovie. I also liked the fact that it was a Linux machine. The negatives of a Mac is that many apps on Windows aren't on Mac and macs tend to be slower. I don't see much work in iOS and instead make only Android apps. I hope that helps

  13. Tchadry Avatar

    Hello Derek, I am a begginer android, ios, and other programming langages(such as C) programer. I'd like to know what can I do with C? Can I make a successful software with it?
    Next, since I know objective-C and I have a windows, I'm thinking about buying a mac to develop Ios apps. Do you think I should do it? What are the pros and cons of a mac for a begginer programmer compared to a windows (other than Xcode support).
    Thanks for everything, YOU'RE THE BEST TEACHER EVER!!

  14. Derek Banas Avatar

    Thank you 🙂 I'd love to start making electronics tutorials, but I always assumed there were thousands of them out there already.

  15. Wayne Green Avatar

    A shame that this quality of instruction cannot be found in PLC programming.

  16. techt338 Avatar

    Thanks for your reply, i have one last question if you dont mind which microphone do you use?

  17. Ethashamuddin Mohammed Avatar

    Will you take handle "File mapped I/O" and "memory mapped I/O" in talking to ports?

  18. Derek Banas Avatar

    Ill see what I can do. I think I'll turn my C tutorial into my fun experiment tutorial and then continue the Android tutorial at the same time. I love playing with electronics 🙂

  19. dasten123 Avatar

    Yes please!! 🙂 And reading from the serial port as well. You could use your Arduino to send some serial data – maybe some people get interested in that topic then =) If you do it in the next couple of weeks, that would actually be pretty helpful to me (I want to read Arduino serial data using C in Java)
    Oh I'm loving this series so much, keep it up! Thanks a ton!

  20. Derek Banas Avatar

    I'm very happy that you enjoy the videos 🙂 Thank you for the compliment. I actually used to teach in job training for the unemployed. I hope to get back involved with teaching in person some day. Sadly I doubt I'll ever teach at a college level. I don't have a masters degree and I'm so old now that I don't have the patience to get one. Who knows what the future holds though?

  21. Charles Ugenti Avatar

    Wow! Thanks for your fast reply. I read about you on your web site. I am a retired teacher and think you should have been a teacher. Thanks again

  22. Nour Avatar

    Yes, It will very exciting to cover serial port (opening, writing to, reading from) in the future ….. thx again sir for your laudable effort and time …. I'm really grateful 🙂

  23. Derek Banas Avatar

    Thank you 🙂 I'll get to that

  24. Charles Ugenti Avatar

    Excellent series! would like to see writing to serial ports next.TY

  25. Derek Banas Avatar

    I think the best free software that runs on every OS is Code::Blocks. Visual Studio is the best paid IDE. Just an opinion.

  26. Derek Banas Avatar

    I make my videos on a Mac. I actually bought a Mac just for making videos. I record screencasts with Cantasia 2 and I edit with iMovie.

  27. Derek Banas Avatar

    You're very welcome 🙂

  28. techt338 Avatar

    Thank you so much for all your videos, i wanted to also ask what software do you use to record your videos?

  29. chemistrypro100 Avatar

    what sdk would you use for c ?

  30. Derek Banas Avatar

    I know it isn't normal with most languages but with C it is considered best to return 0 for a normal exit. In C++ if you don't return anything it actually defaults to 0.

  31. Anthony Olive Avatar

    You should return a 1 or true for a successful run and a zero or false for a failed run, main is a function.

  32. Derek Banas Avatar

    That is an iMovie effect. iMovie is the number one reason to own a Mac in my opinion.

  33. techt338 Avatar

    I wanted to ask how do you make those slide show like slides in the beggining of your video?

  34. Derek Banas Avatar

    Thank you 🙂 You're very kind. May God bless you as well.

  35. University Center Avatar

    you are a genius man… hats off to you… cant say enough about you… God Bless you

Leave a Reply

Your email address will not be published. Required fields are marked *