How do I put a txt file as input for code blocker in c language? I’m not reading
ID: 3742625 • Letter: H
Question
How do I put a txt file as input for code blocker in c language?I’m not reading the file or anything. I’m putting it as argument. How do I put a txt file as input for code blocker in c language?
I’m not reading the file or anything. I’m putting it as argument.
I’m not reading the file or anything. I’m putting it as argument.
Explanation / Answer
#include int main(int argc, char *argv[]) { if(argc > 1) { // if filename is given in command line argument. FILE *fp = fopen(argv[1], "r"); // open file to read // read from file here fclose(fp); // close file here } return 0; }Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.