How To Use ifstream To Read Files | C++ Tutorial

Поделиться
HTML-код
  • Опубликовано: 31 янв 2022
  • How to use ifstream objects to read the contents of files in C++. Source code: github.com/portfoliocourses/c.... Check out www.portfoliocourses.com to build a portfolio that will impress employers!
  • ХоббиХобби

Комментарии • 19

  • @dastin7276
    @dastin7276 Год назад +1

    You are clearly an excellent teacher. Concise, orderly, clear, easy to understand expressions with a good affect. Thank You.

    • @PortfolioCourses
      @PortfolioCourses  Год назад +1

      You're welcome, I'm glad to hear you enjoyed the teaching style! :-)

  • @preoalex8298
    @preoalex8298 Год назад

    No tutorial made me undertand this so easy. Thank you so much.

    • @PortfolioCourses
      @PortfolioCourses  Год назад +1

      You're very welcome Preo, I'm glad you enjoyed it! :-)

  • @hopedonglo3012
    @hopedonglo3012 2 года назад +1

    Thanks for the excellent work!!!

  • @zoxemo3838
    @zoxemo3838 2 года назад

    useful video thx man waiting for more of this content

    • @PortfolioCourses
      @PortfolioCourses  2 года назад +2

      Thank you! We have a playlist of C++ tutorials here that you might enjoy: ruclips.net/p/PLA1FTfKBAEX6BdpNaWp2uw-YspHwY7qwW

    • @zoxemo3838
      @zoxemo3838 2 года назад

      Aw man that's awesome i will check them all thanks 👍

    • @PortfolioCourses
      @PortfolioCourses  2 года назад

      @@zoxemo3838 You're welcome! :-D

  • @FrostGamingHype
    @FrostGamingHype 2 года назад

    sir i wanted to ask that how can i read the line that user wants and the line to end example in void(string file_name,int startline,int endline,int color); like this startline from which line endline till that line

    • @PortfolioCourses
      @PortfolioCourses  2 года назад

      OK, that's a good idea for a video, I will add it to the list. What is "color" supposed to do?

  • @cathlenejaneramboyongbscs-8522
    @cathlenejaneramboyongbscs-8522 2 года назад

    where do i program this, it's not woking in onlinegdb

    • @PortfolioCourses
      @PortfolioCourses  2 года назад

      I was able to get it to work on onlinegdb by creating a new file called file.txt. Here is a link to the code and file: onlinegdb.com/dscXwl9cR. 🙂

  • @stepsvideos
    @stepsvideos Год назад

    It looks easy, but I can't get it to work. I'm using visual studio 2008 express edition, on windows 7. I have tried putting the file.txt in every directory of the project and the program always prints out "Error opening file". I also tried making an executable, and put the file.txt in the same directory as the executable, but it still did not work. Any thoughts?

    • @PortfolioCourses
      @PortfolioCourses  Год назад

      When the project gets built and executed, there is usually some "working directory" that can be configured and changed. It's that working directory where the file would be expected to be. I found this link on changing the working directory: stackoverflow.com/questions/3079128/changing-the-debugging-working-directory-globally-not-per-user-in-vs2008. I would think by default, it would be something like bin/Default or bin/Release or something similar to that. Hopefully this helps! :-)

    • @stepsvideos
      @stepsvideos Год назад

      @@PortfolioCourses Thanks for your reply. At stack exchange I found some code that will 'cout' the current directory, including the program file's name. My file.txt is in that directory. However, the path includes "Visual Studio 2008", which has spaces in it. I will now move the program executable to a folder whose path has no spaces in it, and see if that makes a difference. Thanks again.

    • @besnergreen
      @besnergreen 7 месяцев назад

      c# and visual studio make this so easy. Losing my mind trying to make this shit work in c++ ahaha