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?
 
Ernest022699Connect With a Mentor Commented:
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
 
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
Live webcast with Pinal Dave

Pinal Dave will teach you tricks to help identify the real root cause of database problems rather than red herrings. Attendees will learn scripts that they can use in their environment to immediately figure out their performance Blame Shifters and fix them quickly.

 
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
All Courses

From novice to tech pro — start learning today.