By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,918 Members | 2,246 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,918 IT Pros & Developers. It's quick & easy.

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

P: n/a
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
Jul 23 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
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?
Jul 23 '05 #2

P: n/a
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.
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.

Jul 23 '05 #3

P: n/a
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.
"Anoop Aryal" <aa****@foresightint.com> wrote in message
news:KL*****************@newssvr17.news.prodigy.co m...
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.
Thanks a lot!

Jul 23 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.