[C++ Quick Start Part 3/4] Read, write, and parse files(fstream, string, & stringstream) in 31 min.

แชร์
ฝัง
  • เผยแพร่เมื่อ 16 ก.ย. 2024
  • ►Full C++ Series Playlist: • The C++ Programming La...
    ►Find full courses on: courses.mshah.io/
    ►Join as member to get perks: / @mikeshah
    ►Lesson Description: This is a quick introduction bringing data into your C++ programs as well as writing out data to your C++ programs. I also spend a little bit of time on parsing the data that you read in your programs using stringstream.
    ►Please like and subscribe to help the channel!
    ►TH-cam Channel: / mikeshah
    ►Join our free community: courses.mshah....
  • วิทยาศาสตร์และเทคโนโลยี

ความคิดเห็น • 28

  • @__hannibaal__
    @__hannibaal__ ปีที่แล้ว +1

    I always watch your valuable courses; and mostly I m too lazy to drop a comment. Thanks mike for STL container and adaptors.

    • @MikeShah
      @MikeShah  ปีที่แล้ว

      Cheers, thank you for the kind words and support!

  • @jesperkarlsson6622
    @jesperkarlsson6622 ปีที่แล้ว +1

    very neat series Mike. Many thanks and well done.

    • @MikeShah
      @MikeShah  ปีที่แล้ว

      Cheers, thank you for the kind words!

  • @higiniofuentes2551
    @higiniofuentes2551 11 หลายเดือนก่อน

    Thank you for this very useful video!

    • @MikeShah
      @MikeShah  11 หลายเดือนก่อน +1

      Cheers!

  • @robertstrickland9722
    @robertstrickland9722 ปีที่แล้ว +1

    Hey Mike! A video that I think would be a helpful extension to this one would be working with binary file data. Especially when it comes to outputting the binary data, as a string, to stdout. I've noticed that working with streams and binary data gets a bit more convoluted due to the file stream objects in STL only being able to read data as a char type instead of unsigned char or uint8_t. Never the less, the actual bits of each byte don't change but the interpretation of a byte can be tricky.

    • @MikeShah
      @MikeShah  ปีที่แล้ว +1

      Cheers Robert -- that's a good idea. At some point I want to also do a video on serialization of data, so that would fit nicely.

    • @robertstrickland9722
      @robertstrickland9722 ปีที่แล้ว +1

      @@MikeShah Excellent! I'm looking forward to it. Also, do you have a book recommendation for topics about how to construct/design/architect object oriented code from ideas? I feel like I have a pretty good idea of the C++ language, thanks to your videos, but I stuggle on how to construct my ideas for a program into manageable & sensible object oriented code and program flow.

    • @MikeShah
      @MikeShah  ปีที่แล้ว +1

      @@robertstrickland9722 I like the API Design in C++ book. These free books might also have some good insights: aosabook.org/en/index.html . Probably the other place to look are c++ conference talks -- there are usually some good post-mortems describing architecture overall of software.

  • @dwolrdcojp
    @dwolrdcojp 2 ปีที่แล้ว +3

    Parsing a CSV / Spreadsheet next?

    • @MikeShah
      @MikeShah  2 ปีที่แล้ว +3

      Probably not for this series, but you've actually got the tools you need with stringstream and getline. e.g. std::getline(your_string_stream, chunk, ',');

  • @sixtentamleht8153
    @sixtentamleht8153 ปีที่แล้ว +1

    good video!

  • @leorium
    @leorium หลายเดือนก่อน +1

    how to write a parser and emitter for yaml would it be a hard task? btw, i know there is an existing library but i just want to improve my cpp skill. Thanks🎉

    • @MikeShah
      @MikeShah  หลายเดือนก่อน

      Nice project idea!

  • @escpit
    @escpit ปีที่แล้ว +1

    Hey Mike, cool video. Many thanks. I got a quick question.If I wanna use the 62, so the second row how do I have to code this? Is it like chunk[1] or something different? I'd be happy if you could help me. Many thanks.

    • @MikeShah
      @MikeShah  ปีที่แล้ว +2

      While you read in the 'chunks' from each line, instead of writing them out to stdout, store them in a vector, and then access with chunk[1] as you have suggested. 🙂

  • @higiniofuentes2551
    @higiniofuentes2551 11 หลายเดือนก่อน

    This nice video is for read and write text files, do you have one or more videos for working with binary files? and where to find them!
    Thank you!

    • @MikeShah
      @MikeShah  11 หลายเดือนก่อน +2

      I don't have binary files currently, but I'll add it to the channel somewhere in the future!

  • @higiniofuentes2551
    @higiniofuentes2551 11 หลายเดือนก่อน

    When using sstream, how the program knows the separate values are with spaces?
    A function like split is not better, because of one of the arguments will be the specifical separator?
    Thank you!

    • @MikeShah
      @MikeShah  11 หลายเดือนก่อน +2

      stringstream is basically consume spaces and ignorning theme. Similar to split but with whitespace as the default delimiter.

  • @xc2530
    @xc2530 3 หลายเดือนก่อน +1

    一看就会,一做就废。 ez to watch how Mike does it, hard to do it by yourself

    • @MikeShah
      @MikeShah  3 หลายเดือนก่อน

      Just takes practice -- you'll get it! :)

  • @parneetkaur6996
    @parneetkaur6996 2 ปีที่แล้ว

    Hello Mike, I want to connect with you. Is there a way possible?

    • @MikeShah
      @MikeShah  2 ปีที่แล้ว

      Will consider a discord in the future, otherwise Twitter!

  • @princessannie2106
    @princessannie2106 ปีที่แล้ว

    hi, what book or online source you recommend to a beginneer in C++ who has a background in C

    • @MikeShah
      @MikeShah  ปีที่แล้ว

      The quick start series I have here is good for starting. I'd recommend 'C++ Game Programming' for someone who has programming experience, it's a little older (not as much new C++11 and beyond), but it explains the language and programming well. Otherwise, Bjarne's 'tour of C++' is another nice quickstart guide.
      As for series, my C++ Series(th-cam.com/play/PLvv0ScY6vfd8j-tlhYVPYgiIyXduu6m-L.html) is going through most of the common parts of the language. Jason Turner's C++ Weekly is a good series to follow online as well. CPPCON 'Back to Basics' track also useful if you're trying to learn a specific topic.