My own I/O

I hope it's not a silly question but how would I be able to programm my own I/O function just from nothing, I mean just from pure C++?
Last edited on
I'm afraid I don't know but may I ask why you want to?
"from nothing" is a subjective term.

If you were really starting "from nothing" you'd need to build your own machine.
I think you mean without using std:
 
using namespace std;


By removing the above code, you would in turn have to tell the compiler that you want to use the std for each I/O:

1
2
std::cin >> variableName
std::cout << "Hello" << endl;


Not sure if thats what you wanted
Last edited on
I figured he meant without cin/cout.

The step below that is working with platform specific APIs (ConsoleWrite, etc). But even that isn't "from nothing" because you can go lower than that.

You can always go lower. So really "from nothing" is a little meaningless.

cin/cout are already pretty much "from nothing" in a sense because they're part of the C++ standard and therefore don't require any additional library.
Ok, sorry for not being accurate. But I actually meant, how can I program my own I/O "stuff" without using STL or any other library. So just with using pure C++.

And why? I am just interested.
c++ is a high-level programming language, the libraries are part of the language. If you would like to create your own I/O, then you would have to create your own programming language and start looking into assembly.
Computer engineers work through the gap between hardware and software, which is where assembley comes in. If you want to create your own I/O, then I suggest getting a HUGE background in digital electronics, because you are going to be dealing with a ton of '1's and '0's.
I hope this helps you understand.
even without C++ libraries, you'd still be using libraries in some form. Whether it be through hardware drivers or the OS API. Unless you control the hardware directly, but I'm not sure you can even do that anymore (since modern PCs are multitasking environments, direct access to the hardware is no longer commonplace. Instead the OS interacts with the hardware and you interact with the OS. This avoids big messes caused by all different programs trying to mess with the hardware at the same time).

So yeah, basically what you're asking doesn't make any sense.
Topic archived. No new replies allowed.