I know that it is possible to output and get input from the console without using iostream and it's cout and cin using the Windows API. I don't know how to do this because I'm new to c++ but I know it has something to do with kernel32. Can anyone help?

Recommended Answers

All 7 Replies

If your new to C++, you should start on something much easier. I don't even know how to do this, but I can guess it involves some pretty complex stuff, so I don't think you're going to get this done unless someone literally gives you the entire code.

That's what i need :)

Couldn't use you

#define print(s) printf(s);

dunno though :)

The implementation of cin and cout is compiler/os dependent. On MS-Windows I suspect Microsoft implemented it by using win32 api console functions. And, as others have said, this is very advanced programming. Here is some source code if you are up to the task.

You will find more information here.

#define print(s) printf(s);

My eyes burn! :confused:

#include "stdafx.h"
#using  <mscorlib.dll>

int main()
{
	System::Console::WriteLine("Hello World");

	return 0;
}

//To compile this you need to change your compiler options.
//If your using VS2008 or VS2005 you need to:
//go to Project > your_projects_name Properties...
//Expand C/C++
//In general: set debug information format to C7 Compatible
//In code generation: set enable min rebuild to No
// set basic runtime checks to default
//In command line: put /cls into the textarea
//
//I may have missed one of the compiler options.

//stdafx.h is a precompiled header file made by VS, its needed so that mscorlib.dll knows what operating system your running and which system commands you can use.

CODE TAGS! And this is an old thread.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.