Xiaopeng Xiong wrote:
If there is any command for formatting all files under a directory, that
would be best.
But currently, formatting a single file is enough for me. I just can not
type TAB at each line.
Is there a C++ _language_ question I'm not seeing? Are you asking how to
open files and replace their contents with other contents? std::fstream
class is used for file reading/writing. Replacement is rarely done in
place, you're better off creating a new file for every one you need to
edit, and then renaming the old file with .bak or something and the new
file to have the name of the old file. 'std::ifstream' is for reading
and 'std::ofstream' is for writing.
Or maybe you're asking about a tool that can change your source files for
you? Look up "C++ beautifier" on the Web. If you need to know how to do
the formatting in your text editor, why don't you just RTFM?