Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8944793
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T12:06:07+00:00 2026-06-15T12:06:07+00:00

I had learned that inline ostream & _Cdecl ostream::operator<< (const signed char * _s)

  • 0

I had learned that

inline ostream & _Cdecl ostream::operator<< (const signed char * _s) {
    outstr(_s, (const signed char *)0);
    return *this;
}

is how the insertion operator (<<) is declared(overloaded) in the iostream.h header file. Can I possibly use the same function to print a string value on screen?

I tried

#include<iostream.h>
int main() {
    outstr("Hello world!", (const signed char *)0);
    return 0;
}

it ended up in error. I would like to use something like this in order to see if there is some possible way to answer this query of printing something on screen without using printf, cout or puts().

Update: I would welcome if you have any suggestions other than

#include<stdlib.h>
void main() {
    system("echo /"Hello world!/"");
}

NB: I have no restrictions if you can provide the C equivalent code that can print without a printf(), cout or puts()

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T12:06:08+00:00Added an answer on June 15, 2026 at 12:06 pm

    If you want portability across all standards compliant C++ implementations, you can print a string to standard output in the following ways

    const char * str = "Hello World\n";
    fprintf(stdout, str);
    fputs(str, stdout);
    for (int i=0; str[i]!=0; ++i)
        putchar(str[i]);
    for (int i=0; str[i]!=0; ++i)
        putc(str[i], stdout);
    for (int i=0; str[i]!=0; ++i)
        fputc(str[i], stdout);
    fwrite(str, sizeof(*str), strlen(str), stdout);
    

    Additionally, you can use std::cerr and std::clog. They write to stderr instead of stdout, but from the user’s perspective, that’s often the same place:

    std::cerr << str;
    std::clog << str;
    

    From an efficiency perspective, I doubt any of these are going to help you. For that purpose, you might want to look at something a bit more platform specific. For POSIX systems, see the answer given by Dave S. For Windows, see this link.

    What you shouldn’t do, is open up your header files and imitate what they use. At least, not at the middle levels, where they are using different various obscure functions within their own implementation. Those functions might not exist upon the next release. However, if you go to the deepest levels, you will find OS specific calls like the ones in the link I provided above. Those should be safe to use as long as you stay on the same OS, or even between OS versions.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I learned that IQueryable or IEnumerable datatypes do not return the results at the
Through tutorials I had learned that you can define two variables in the same
I had learned that in Java the static block gets executed when the class
I'm just learning JSF 2 thanks to this site I had learned a lot
Had a page that was working fine. Only change I made was to add
Had a good search here but can't see anything that gets my mind in
Had a problem with the recursive conflictCheck() method. That seems fine now. I have
Had this working; at one stage. The problem is the following text is now
I had a debate about macros and their readability. I think that in some
When developing in Java a couple of years ago I learned that it is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.