Is it possible to read a C++ source file using stream operators? I want to read a source file and output all the comments contained in that source file.
I have the code which works with a text file, however I would like the ability for the user to upload their source code, and my program to read the source code as if it was a text file.
I have the comment portion already created, but so far my program just reads text files, and I would like it to be able to read a C++ source code (and in the future, html, css, java etc.)
By using fstream, I can also read c++ source code? I didn't know that, so I can use for example,
name of cpp: "main.cpp"
std::ifstream reader("main.cpp");
and this will treat it as if it was a text file or a binary file?