Please help: How to reformat existing c++ files using emacs or VC6.0

X

Xiaopeng Xiong

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.
Thanks a lot!



--
Xiaopeng Xiong
CS143, Computer Sciences Building
Purdue University, West Lafayette, IN, 47907
Tel: (765)496-6038
URL: http://www.cs.purdue.edu/homes/xxiong
 
V

Victor Bazarov

Xiaopeng said:
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::eek:fstream' 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?
 
A

Anoop Aryal

Xiaopeng said:
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.
Thanks a lot!

i would venture to say your post is OT. post to emacs or VC NG. but, i'll
answer anyhow. for emacs. i haven't used anything but in a long time so i
wouldn't know how to do it in VC.

i don't know about doing a whole directory at a time - although it's
certainly possible with emacs. for a single file, open the file, make sure
you're in c/cpp mode. type:

C-x-h
C-M-\

cheers,
anoop aryal.
 
X

Xiaopeng Xiong

Okay I see the question is out of the scope here. Let's finish this topic
now. Sorry.
Thanks Victor and Anoop for the detailed help. I did get some ideas out of
the replies.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top