• C

c using MSVC++6

I am just beginning to learn to program in C, but I am using MS Visual C++6. I just want to make a DOS C program, so I choose the Win32 Console Application. However, I always get a source file with an extension .cpp instead of just .c  Please tell me how to change the file to a .c file.

Thanks!
limvaAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ernest022699Commented:
Don't.  You can have C code in a file with any extension, and the compiler (and other programs) will recognize .cpp as containg code it knows.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
limvaAuthor Commented:
Thanks Ernest, just one more thing. I am taking a course in Introductory C on the internet, and my instructor told me to make sure my extension was .c and not .cpp. So, you are sure that .cpp is, in practice, same as .c?

Thanks again!

limva
0
sindbadCommented:
You can create a new plain "C" file instead of a C++ file.

1. Press CTRL+N
2. Select "Files" tab in the dialog.
3. Select "C/C++ Header file" from the list of file types.
4. Enter your file name.

This creates a C file with extension .c instead of a C++ file.

Alternatively, in the Win Explorer go to the concerned C++ file and rename the file to have it's extension to .c from .cpp

0
KuppingerCole Reviews AlgoSec in Executive Report

Leading analyst firm, KuppingerCole reviews AlgoSec's Security Policy Management Solution, and the security challenges faced by companies today in their Executive View report.

Ernest022699Commented:
If you are using Micro$oft's Visual C++, then renaming one of the files will make it unusable in your project because of the way Visual Studio handles projects.
0
limvaAuthor Commented:
Thanks Ernest for the info.  Also thanks to sindbad, I'm still playing around with your idea but I think it works!
0
limvaAuthor Commented:
Thanks Ernest for the info.  Also thanks to sindbad, I'm still playing around with your idea but I think it works!
0
sindbadCommented:
Oops, I forgot to add the following in case of renaming a .cpp file to .c file.

Go to VC++ env.
Delete the concerned unwanted .cpp file in FileView tab of project's workspace.

Select Project->Add to Project->Files from the menu.
Add the concerned .c file to the project.

Hope this completes the process.

0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C

From novice to tech pro — start learning today.