473,703 Members | 2,599 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

cout implementation

hi all,

Is it true that the cout function used in C++ for printing data
to the console is implemented via the "write" system call?
If not then how the cout function is implemented?

Thanks,
Candice

Jul 22 '05 #1
2 3912
The implementation of cout is up to the person doing the
implementation. On UNIX (and similar) systems, it probably does use
write. On other systems, there is no system call named 'write'...

--
Later,
Jerry.

The universe is a figment of its own imagination.

Jul 22 '05 #2

ca********@yaho o.com wrote:
hi all,

Is it true that the cout function used in C++ for printing data
to the console is implemented via the "write" system call?
If not then how the cout function is implemented?


In Windows it will probably be WriteConsoleA; it doesn't have
a write() system call. Other systems don't have WriteConsoleA
so they may use other system calls. In DOS, you don't even
need a system call. You can simply create a pointer to the
screen and just copy the bytes.

Regards,
Michiel Salters

Jul 22 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
5746
by: Me | last post by:
Hi, I would like learn from people with experience in C++, which of the following styles of way to construct "get/set" member functions would be the best in terms of usability, speed, et cetera. The following class with be used as an example: class MyClass { public: // member function would go here. private: int data_;
3
698
by: forums_mp | last post by:
After reading a few texts - nameley koeing/moo and eckel - I decided to investigating the importance of templates. Of course there's no substitute for practice so I figured I try a simple program. That said I'm interested in suggestions for improvement on the template class (be gracious i'm slowly coming up to speed in ++ :)) but more importantly I have a few questions. For starters, in an ideal world each call to Store should be...
1
1823
by: candy_init | last post by:
hi all, Is it true that the cout function used in C++ for printing data to the console is implemented via the "write" system call? If not then how the cout function is implemented? Thanks, Candice
3
2448
by: Thomas Ibbotson | last post by:
I've been going through a tutorial on C++ and I've come across what I regard as some strange behaviour. As part of the tutorial on classes a simple stack is implemented with functions push() and pop(). I test this stack using: stack a_stack; // Create an instance of stack // Push some data onto the stack a_stack.push(1); a_stack.push(2);
5
2333
by: christophe (dot) poucet (at) gmail (dot) com | last post by:
Hello, I noticed there is a flaw in the vector implementation of g++ (3.4). Basically when you erase an element from a vector, it calls the wrong destructor. In most cases this is not such a big issue, but if one were to store a class holding a resource, then the wrong resource would be freed. Here is a test case to show what I mean: (Disregard the destructors called for the temporaries).
12
6095
by: Filipe Sousa | last post by:
Hi! Could someone explain to me why this operation is not what I was expecting? int main() { int x = 2; std::cout << x << " " << x++ << std::endl; return 0; }
3
551
by: worlman385 | last post by:
why when I use cout, I must put - using std::cout; #include <iostream> using std::cout; if i look at iostream, it seem cout is defined in iostream - __PURE_APPDOMAIN_GLOBAL extern _CRTDATA2 ostream cout; I also see _STD_BEGIN
17
10066
by: Ankur Arora | last post by:
Hi All, I'm building a sample application that uses a custom auto_ptr implementation. The program crashes with the following output:- Output (Debug Assertion failed) ----------
0
8740
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9236
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9094
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7839
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5918
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4415
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3108
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2416
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2047
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.