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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T04:38:07+00:00 2026-05-28T04:38:07+00:00

error C2784: ‘std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,const std::basic_string<_Elem,_Traits,_Alloc> &)’ : >could not deduce template argument

  • 0

error C2784: ‘std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,const std::basic_string<_Elem,_Traits,_Alloc> &)’ : >could not deduce template argument for ‘std::basic_ostream<_Elem,_Traits> &’ from >’std::string’ c:\documents and settings\rcs\my documents\visual studio 2010\projects…

the Code is :

#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include "Pacient.h"

using namespace std;

void ruajKartele(Pacient patient)
{
    int mosha;
    char gjinia;
    string foo=patient.getEmer();
    string skedar=foo;
    ofstream file;
    file.open(skedar, ios::app);
    skedar<<foo+"\n";
    mosha=patient.getMosha();
    gjinia=patient.getGjinia();
    foo=patient.getDiagnoza();
    skedar<<mosha<<"\n"<<gjinia<<"\n"<<foo<<"\n";
    foo=patient.getPrognoza();
    skedar<<foo+"\n";
    skedar<<"-----\n"; //5
    skedar.close();
}
int _tmain(int argc, _TCHAR* argv[])
{
    return 0;
}
//Pacient structure:
    #include <string>
class Pacient
{
protected:
    std::string emer;
    int mosha;
    char gjinia;
    std::string diagnoza;
    std::string prognoza;

public:
    Pacient(void);
~Pacient(void);
void setEmer(std::string);
void setMosha (int);
void setGjinia(char);
void setDiagnoza(std::string);
void setPrognoza(std::string);
std::string getEmer(void);
int getMosha(void);
char getGjinia(void);
std::string getDiagnoza(void);
std::string getPrognoza(void);
};
  • 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-28T04:38:07+00:00Added an answer on May 28, 2026 at 4:38 am
    string skedar=foo;
    ofstream file;
    file.open(skedar, ios::app);
    skedar<<foo+"\n";
    

    skedar is a std::string, that (apparently) represents a path. file is an ofstream. If you want to write to that stream, you can’t skedar << "whatever";, you need to output to the ofstream:

    file << foo << "\n";
    

    Same for skedar.close();: it’s the file you want to close, not the string that represents its filename.

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

Sidebar

Related Questions

the code below produces compiler error C2784: 'bool std::operator <(const std::_Tree<_Traits> &,const std::_Tree<_Traits> &)'
//error C2784: 'HRESULT get_wrapper(T *,boost::function<R(void)>)' : //could not deduce template argument for 'boost::function<R(void)>' //from
Error: Could not find control 'mytextfield' in ControlParameter 'mycontrolparam'. <asp:ControlParameter ControlID=mytextfield Name=mycontrolparam PropertyName=Text Type=Int32
Error: End tag for 'optgroup' which is not finished. You have probably failed to
Error % javac StringTest.java StringTest.java:4: variable errorSoon might not have been initialized errorSoon[0] =
I would like to bind the << stream operator: for_each(begin, end, boost::bind(&operator<<, stream, _1));
When i go to compile this code it gives me error C2784: error C2784:
Error in NSLog: *** -[NSThread initWithTarget:selector:object:]: target does not implement selector (*** -[Document myTcpClient])
I'm trying to fill std::map with std::transform. Next code compiles without error: std::set<std::wstring> in;
Error: error C2678: binary '==' : no operator found which takes a left-hand operand

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.