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 1010843
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T09:08:42+00:00 2026-05-16T09:08:42+00:00

Like this function in C: size_t fwrite ( const void * ptr, size_t size,

  • 0

Like this function in C:

size_t fwrite ( const void * ptr, size_t size, size_t count, FILE * stream );

I’ve looked in C++ file stream and found this one:

ostream& write ( const char* s , streamsize n );

this one only accepts char* instead of void*

but does it really matter if I use a C-style fwrite function in c++?

  • 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-05-16T09:08:43+00:00Added an answer on May 16, 2026 at 9:08 am

    Streams are probably what you’re looking for unless I misunderstand your question. There are many flavors that handle different jobs, like outputting to a file:

    #include <cstdlib>
    #include <fstream>
    #include <string>
    using namespace std;
    
    
    int main()
    {
        ofstream f("c:\\out.txt");
    
        const char foo[] = "foo";
        string bar = "bar";
        int answer = 42;
    
        f << foo << bar<< answer;
    
        return 0;
    }
    

    …building strings like you would with printf:

    #include <cstdlib>
    #include <sstream>
    #include <string>
    #include <iostream>
    using namespace std;
    
    
    int main()
    {
        stringstream ss;
    
        const char foo[] = "foo";
        string bar = "bar";
        int answer = 42;
    
        ss << foo << bar<< answer;
        string my_out = ss.str();
    
        return 0;
    }
    

    …and they can even handle your own types, if you tell them how:

    #include <cstdlib>
    #include <string>
    #include <iostream>
    using namespace std;
    
    class MyGizmo
    {
    public:
        string bar_;
        int answer_;
    
        MyGizmo() : bar_("my_bar"), answer_(43) {};
    };
    
    ostream& operator<<(ostream& os, const MyGizmo& g)
    {
        os << g.bar_ << " = " << g.answer_;
        return os;
    }
    int main()
    {
        MyGizmo gizmo;
        cout << gizmo;
    
        return 0;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 502k
  • Answers 502k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Try binding the images from ObservableCollection which will return the… May 16, 2026 at 2:42 pm
  • Editorial Team
    Editorial Team added an answer When you say "HtmlTextWriter doesn't seem to want to write… May 16, 2026 at 2:42 pm
  • Editorial Team
    Editorial Team added an answer <ul class= "list" id = "<%=ViewData["test"]%>"> May 16, 2026 at 2:42 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

Consider the following C++ member function: size_t size() const { boost::lock_guard<boost::mutex> lock(m_mutex); return m_size;
The usual definition for a specialization of a template function is something like this:
This is a question based on C code for Win32. In one of my
I want to store the result of this curl function in a variable, how
I have a form like this: <form id=form_main name=form_main action=/search/ target=iframe001 method=get onSubmit=reset_and_subm();> Enter
I'm reading from a binary data file which is written by invoking the following
I'm trying to read a binary file (which represents a matrix in Matlab) in
I've written a little function to take a url, and resize the image and
I know this has been asked before but none of the cases I've seen
Hey all, I'm trying to write a sort function but am having trouble figuring

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.