Video není dostupné.
OmlouvĂĄme se.

Reading and Writing to Files (ifstream and ofstream) - C++ Tutorial 25

SdĂ­let
VloĆŸit
  • čas pƙidĂĄn 22. 12. 2022
  • Start your software dev career - calcur.tech/dev-fundamentals Visual Assist - calcur.tech/vassist
    💯 FREE Courses (100+ hours) - calcur.tech/all-in-ones
    đŸŽ„ C++ CZcams Playlist - calcur.tech/cpp-playlist
    ⚛ FREE React Course (20 hours) - calcur.tech/free-react-course
    ✅ Data Structures & Algorithms - calcur.tech/dsa-youtube
    ~~~~~~~~~~~~~~~ CONNECT ~~~~~~~~~~~~~~~
    ✉ Newsletter - calcur.tech/newsletter
    📾 Instagram - / calebcurry
    🐩 Twitter - / calebcurry
    🔗 LinkedIn - / calebcurry
    ▶ Subscribe - calcur.tech/subscribe
    đŸ‘šđŸ»â€đŸŽ“ Courses - www.codebreakthrough.com
    ~~~~~~~~~~~~~~ SUPPORT ME ~~~~~~~~~~~~~~
    â†Ș My Amazon Store - www.amazon.com/shop/calebcurry
    🅿 Patreon - calcur.tech/patreon-calebcurry
    🅖 GitHub Sponsors - github.com/sponsors/CalebCurry
    Ⓟ Paypal - paypal.me/calcur

Komentáƙe • 24

  • @keatodiet
    @keatodiet Pƙed rokem +89

    I can't believe the real badger from breaking bad gave up selling meth-amphetamine and decided to teach me how to use the c++ standard library. true hero :)

  • @StarsStillHere
    @StarsStillHere Pƙed 8 měsĂ­ci +17

    You explained this so simply and yet so effectively. Singlehandedly saving my course grade here. Thanks lots

  • @codebreakthrough
    @codebreakthrough  Pƙed rokem +2

    ⭐Get Visual Assist - calcur.tech/vassist
    C++ CZcams Playlist - calcur.tech/cpp-playlist

  • @ineedzemedic5810
    @ineedzemedic5810 Pƙed 5 měsĂ­ci +5

    I hope you sleep every night with sweet dreams. You explained it better than my professor did.

  • @devmarboy4045
    @devmarboy4045 Pƙed rokem +16

    thanks now i can create some kind of load and save system

  • @superdhave5471
    @superdhave5471 Pƙed 8 měsĂ­ci +1

    loveyouuuu u help me to my problem

  • @bodeabbott3261
    @bodeabbott3261 Pƙed rokem

    how would I use a function that writes its output as a string to a file

  • @abdulsammadsaeed1199
    @abdulsammadsaeed1199 Pƙed 9 měsĂ­ci +2

    Thanks it worked for me.
    But i am kinda confused--> in the while loop u just used "FILE" as a length and u inserted the values in the vector "FOODS" using ""FOOD". How did it entered the values? I am not getting that part.

    • @abdul4515
      @abdul4515 Pƙed 8 měsĂ­ci +1

      He didn't use file as the length, he used file >> food. Which evaluates to true so long as there is stuff to fetch from the file. That's what the condition is. it checks to see if you can read from the file, if the check is successful, the while loop iterates, and the push_back() function adds the food item into foods. If it is not successful, we exit the while loop and then the rest of the program continues.

    • @abdulsammadsaeed1199
      @abdulsammadsaeed1199 Pƙed 8 měsĂ­ci

      @@abdul4515 Ohhhhh that makes more sense! Thankyou!

  • @Austin-cr5zo
    @Austin-cr5zo Pƙed rokem

    Say you make this file, and it’s to read names. How would you get the file to sort the names in alphabetical order?

    • @saraalouh1877
      @saraalouh1877 Pƙed rokem +2

      You would probably need to create a function that will alphabetize a bunch of strings, then feed the contents of the file through it. You would probably need to save them to a new file, or find a way to delete the contents of the first file and reupload them to it.

    • @TheHset
      @TheHset Pƙed rokem +1

      You would have to create your own sorting algorithm and have some form of temporary string storage, as Sara said.

  • @gunar3939
    @gunar3939 Pƙed 9 měsĂ­ci

    Hi, I just want to create a file in cpp. I will update the contents of the file later. Can anyone share me the code for only creating a file? Sorry, I am actually confused with the C style file handling.

    • @abdul4515
      @abdul4515 Pƙed 8 měsĂ­ci +1

      #include
      #include
      int main()
      {
      std::ofstream file("filename.txt"); //change "filename" to whatever name you want.
      file.close();
      }

  • @jezeradrian5267
    @jezeradrian5267 Pƙed 8 měsĂ­ci +1

    lemons

  • @patrpatl
    @patrpatl Pƙed 2 měsĂ­ci

    I never saw someone eat lemons.

  • @saexpat
    @saexpat Pƙed 9 měsĂ­ci +1

    How to check if file exists?

    • @moneycoding
      @moneycoding Pƙed 8 měsĂ­ci

      check the cpp file

    • @moneycoding
      @moneycoding Pƙed 8 měsĂ­ci

      and you will see the txt file beside it

  • @teamlaith2259
    @teamlaith2259 Pƙed 4 měsĂ­ci +1

    I don’t know if it’s me or you over complicated the c++ language this video made me forget c++ xd

  • @AnimalSyndicate
    @AnimalSyndicate Pƙed 5 měsĂ­ci

    Please, do not use string or the bloat amount of libraries except for and . This is about new programmers learning C++.