envp is on POSIX > 1.1, maybe DOS had it too, but I know it was UNIX.
Printable View
envp is on POSIX > 1.1, maybe DOS had it too, but I know it was UNIX.
I am using Visual C++ for more than 18 years and created hundreds of console projects. I don't know any other IDE which makes it so easy to create and run a console program from the IDE in the debugger. It is right that MS changes the default of the default character set from ANSI (multi-byte charset) to UTF-16 (unicode charset) and therefore you have to change the main entry point (the _tmain allows a switch between both character sets) if you don't want that proprietary feature. But, though annoying and confusing for the first time, it can be changed within seconds even if you missed to check the Empty Project flag when creating the project. Simply change the line
intoCode:int _tmain(int argc, _TCHAR* argv[])
orCode:int main(int argc, char* argv[])
Code:int main()
and choose 'Use Multi-Byte Character Set' in
Projects - Properties - Configuration Properties - General - Character Set
for both Debug and Release configuration. That's all cause the _tmain is only a preprocessor macro (same as _TCHAR), which either maps to main or to _wmain (for wide characters commandline input) and only the _wmain is a newly defined entry point.
To break the program before exit when running in the debugger you simply can run your code in a loop what furthermore would improve your program:
Code:int main()
{
while (true)
{
double f;
double m;
cout << "Enter the length in feet: ";
cin >> f;
m = f/3.28;
cout << f << "feet is"<< m << "meters" << endl;
cout << "Continue (y/n)? ";
char c;
cin >> c;
if (c != 'y')
break;
}
return 0;
Interesting. :) That also gives a simple explanation for the compiler complaining about an attempt to overload main() I mentioned above.
Considering all your other explanations, is this then really still required if I don't use any "_T()-aware" (which would also mean MS-specific) stuff? This stuff isn't used in the usual textbook sample code. I managed to get at least the most basic C++ "Hello world!" (using std::cout) to work without changing anything in the project settings.Quote:
[...] and choose 'Use Multi-Byte Character Set' [...].
Or to put the question much shorter: Does the character set setting do anything else at all besides defining (or not defining) _UNICODE?
No, I think that's all the character set setting does.