Read A File And Display Its Contents | C Programming Example
ฝัง
- เผยแพร่เมื่อ 26 ส.ค. 2024
- Example of reading and displaying the contents of a file using C. Source code: github.com/por.... Check out www.portfolioc... to build a portfolio that will impress employers!
- แนวปฏิบัติและการใช้ชีวิต
This is literally the best one could ask for in a programming course, lol. What's the catch? Seriously this is literally perfection in teaching a "part". One can follow and understand every step. Good mic quality, good onscreen information, and good english language. Only real criticism is that lightmode hurts my eyes (joke). Great job and Thank you!!
You're welcome, thanks for providing all this positive feedback it's very motivating to hear that, and I'm glad you enjoyed the video! :-)
Amazing set of videos. One video of interest might be why windows complains about using fopen as opposed to fopen_s(). This has always puzzled me.
YOU HELPED SO MUCH OMG THANK YOU
I’m so glad to hear that, and you’re very welcome! :-)
Your voice and tonality 100℅ resembles Robert downey junior...Ironman🎉
Error opening file😢
Idk why, I even tried using path it won't work.I am using vscode btw
Asante Sana
Nothing gets printed on the terminal even though the txt file is not blank.
Can you copy and paste in your code as a comment so I can try it out? The program should work.
@@PortfolioCourses I forgot to add the file into the folder :/.Thanks for reaching out tho!
Ok I’m glad to hear you figured it out! :-)
can i use printf instead of putchar? i tried and it worked
Yes that should work fine too!
SO what about if you are trying to obtain a word from the file? Then what?
I've been deep searching for a long time and cannot find a single solution to this and just left stranded as I am a new C programmer all I keep looping back to is "Hey now you can print the text from the file into a CMD / Terminal" rather than being able to actually do anything with that data from the file.
It depends on what you mean by "obtain a word". That could mean a lot of different things. Does obtain mean "read the word"? Do you know where in the file the word is, like the line number?
You'll find that a lot of really common problems have tutorials available for them, but less common problems do not. What you may need to do is combine ideas from different tutorials and solutions into a new solution that solves your problem. For example here are other videos about reading lines from files in different ways:
th-cam.com/video/w0mgn6OLKUs/w-d-xo.html
th-cam.com/video/X-1qodkHCHo/w-d-xo.html
Depending on what your problem is, these might help you more or they might not. You may also need to find tutorials or videos that are about working with strings in order to solve the problem. For example there are tutorials/videos out there like this about dealing with words in strings:
th-cam.com/video/vpdraEnrFnU/w-d-xo.html
Anyways, that's my advice, that you might need to combine ideas from different tutorials to create your own solution to the problem, I hope this helps. :-)
Hi, i'm not sure if you're still responding to comments, but i tried vc code in vs and putchar(c) isn't displaying what i have in the text file. I copied the exact same code you're using.
putchar is crap, use printf instead
Thank youu........ Soo much
You’re welcome! :-)
Helped Again !!!
Awesome, I'm very glad to hear it helped you out! :-D
Result where
I'm not sure what you mean. The output should be on the terminal (i.e. the console). :-)