473,765 Members | 1,964 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

error C2679: binary '<<' : no operator found which takes a right-hand operand of type 'std::string' (or there is no acceptable conversion)

Hi,
I have written this code, and at the end, I am trying to write a
vector of strings into a text file. However, my program is nor
compiling, and it gives me the following error when I try to write to
the file:

error C2679: binary '<<' : no operator found which takes a right-hand
operand of type 'std::string' (or there is no acceptable conversion)

I don't know what I am doing wrong. I have posted my entire program
here.
Thank you

#include <iostream>
#include <fstream>
#include <iterator>
#include <algorithm>
#include <vector>
#include <math.h>
#include "string.h"

using namespace std;

char n_str[2000];
char a_str[2000];

char n_char[2000];
char a_char[2000];
string achar, nchar;
int main(int argc, char* argv[])
{
vector<stringn_ word_list;
vector<stringa_ word_list;

ifstream in_a("10_a.txt" );
if (!in_a)
{
cout << "Error opening abnormal file" << endl;
}
while (!in_a.eof())
{
in_a.getline(a_ str,2000);
a_word_list.pus h_back(a_str);
}
cout << a_word_list.siz e()<< endl;

ifstream in_n("10_n.txt" );
if (!in_n)
{
cout << "Error opening normal file" << endl;
}
while (!in_n.eof())
{
in_n.getline(a_ str,2000);
n_word_list.pus h_back(a_str);
}
cout << n_word_list.siz e()<< endl;

for (unsigned int i=0; i<a_word_list.s ize(); i++)
{
for (unsigned int j=0; j<n_word_list.s ize();j++)
{
if (a_word_list[i].compare( n_word_list[j]))
{
a_word_list.ass ign(1,"aa");

n_word_list.ass ign(1,"aa");

}
}
}

ofstream out_a("10_a_new .txt");
if (!out_a)
{
cout << "Error opening new abnormal file" << endl;
}
for (unsigned int i=0; i<a_word_list.s ize(); i++)
{
achar = a_word_list.at( i);
out_a << achar << endl; //ERROR
}
ofstream out_n("10_n_new .txt");
if (!out_n)
{
cout << "Error opening new normal file" << endl;
}
for (unsigned int i=0; i<n_word_list.s ize(); i++)
{
out_n << n_word_list.at( i) << endl; //ERROR
}
return 0;
}

Jun 17 '07
29 23218
On Jun 19, 12:27 am, "Default User" <defaultuse...@ yahoo.comwrote:
James Kanze wrote:
[...]
Your criticism of it wasn't.
It certainly was.
If you don't know how to read (the FAQ), I can't help you.
BTW, if you can't get Google to post this correctly, consider
dropping it. I understand that some people have no choice but to
use their inadequate system, but it's incumbent upon you to work
with the problems.
Modulo errors of manipulation on my part, my postings are
conform, even if they're not what I want.
You're responsible for the broken software you use. If GG can't do
.sigs right, then don't use them.
Except that the .sig was correct in the original of the post you
quoted. I've fixed that so that it (normally) works.
If OE can't quote
them correctly, it's not an acceptable newsreader.
What does OE have to do with anything? I'm talking about your broken
.sig separator, not quoting.
The .sig separator shows up correct in the posting, at least in
Google groups. "-- \n". The space is there in what is
propagating via NNTP.

--
James Kanze (GABI Software, from CAI) email:ja******* **@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientier ter Datenverarbeitu ng
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34

Jun 19 '07 #21
James Kanze wrote:
On Jun 19, 12:27 am, "Default User" <defaultuse...@ yahoo.comwrote:
James Kanze wrote:

[...]
Your criticism of it wasn't.
It certainly was.

If you don't know how to read (the FAQ), I can't help you.
I did not admonish anyone for following the FAQ. Drop the strawman.
You're responsible for the broken software you use. If GG can't do
.sigs right, then don't use them.

Except that the .sig was correct in the original of the post you
quoted.
No, it wasn't. It's coming out without the space. I realize you pasted
it in with one, but Google is breaking it.
I've fixed that so that it (normally) works.
No, it doesn't. Never. Every .sig you put out is missing the space in
"-- ".

If OE can't quote
them correctly, it's not an acceptable newsreader.
What does OE have to do with anything? I'm talking about your broken
.sig separator, not quoting.

The .sig separator shows up correct in the posting, at least in
Google groups. "-- \n". The space is there in what is
propagating via NNTP.

Hmmm. That's not what I'm seeing here. I also checked it via Google
Groups, and I don't see the space there either (based on clicking
Reply).

Anybody else getting a correct .sig separator?

Brian
Jun 19 '07 #22
On Jun 19, 6:09 pm, "Default User" <defaultuse...@ yahoo.comwrote:
James Kanze wrote:
On Jun 19, 12:27 am, "Default User" <defaultuse...@ yahoo.comwrote:
James Kanze wrote:
You're responsible for the broken software you use. If GG can't do
.sigs right, then don't use them.
Except that the .sig was correct in the original of the post you
quoted.
No, it wasn't. It's coming out without the space. I realize you pasted
it in with one, but Google is breaking it.
I've fixed that so that it (normally) works.
No, it doesn't. Never. Every .sig you put out is missing the space in
"-- ".
If OE can't quote
them correctly, it's not an acceptable newsreader.
What does OE have to do with anything? I'm talking about your broken
.sig separator, not quoting.
The .sig separator shows up correct in the posting, at least in
Google groups. "-- \n". The space is there in what is
propagating via NNTP.
Hmmm. That's not what I'm seeing here. I also checked it via Google
Groups, and I don't see the space there either (based on clicking
Reply).
Google's wierd. If I click on Reply, the sig is quoted, and the
trailing space is stripped of. If I copy/paste the message into
another editor, however, the final space is there. If I click
on options, and then "show original posting", it's not.

My tests were based on copy/pasting the message into another
editor. Still, I suspect that if I get it anywhere, it is
present on the network; I can't quite imagine Google adding it
in in some cases.
Anybody else getting a correct .sig separator?
I'm curious as well. But when you normally don't see it, what
tool are you using?

(I'm also curious as to why this sort of thing has suddenly
started causing problems. For many, many years, I used "|>" for
citing, and didn't have the space, and it never caused anyone
problems anywhere.)

--
James Kanze (GABI Software, from CAI) email:ja******* **@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientier ter Datenverarbeitu ng
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34

Jun 20 '07 #23
On Jun 20, 4:02 am, James Kanze <james.ka...@gm ail.comwrote:
On Jun 19, 6:09 pm, "Default User" <defaultuse...@ yahoo.comwrote:
Hmmm. That's not what I'm seeing here. I also checked it via Google
Groups, and I don't see the space there either (based on clicking
Reply).

Google's wierd. If I click on Reply, the sig is quoted, and the
trailing space is stripped of. If I copy/paste the message into
another editor, however, the final space is there. If I click
on options, and then "show original posting", it's not.
Hmmm, I did a cut and paste from Google's display, and I do see the
space that way.
My tests were based on copy/pasting the message into another
editor. Still, I suspect that if I get it anywhere, it is
present on the network; I can't quite imagine Google adding it
in in some cases.
I'm actually posting this from Google Groups. I'll add a manual .sig
and see how it looks to me with my regular newsreader.
Anybody else getting a correct .sig separator?

I'm curious as well. But when you normally don't see it, what
tool are you using?
My normal setup is XanaNews, with signatures set to "strict". That
means that it requires the space. It handles most other .sigs here.
It's fairly easy to tell because I have the fonts set to display .sigs
in a different color.
(I'm also curious as to why this sort of thing has suddenly
started causing problems. For many, many years, I used "|>" for
citing, and didn't have the space, and it never caused anyone
problems anywhere.)
--
Manual signature, dash dash space entered by hand.
Jun 20 '07 #24
Default User wrote:

I'm actually posting this from Google Groups. I'll add a manual .sig
and see how it looks to me with my regular newsreader.
--
Manual signature, dash dash space entered by hand.

I don't see this as a correct .sig either.


Brian
Jun 20 '07 #25

Default User <de***********@ yahoo.comwrote in message ...
Default User wrote:
I'm actually posting this from Google Groups. I'll add a manual .sig
and see how it looks to me with my regular newsreader.
--
Manual signature, dash dash space entered by hand.

I don't see this as a correct .sig either.
Brian
Slaughtered here too.

I have checked my own OE generated sig. uploaded to my ISP, and back == OK.
So, it is another 'news' capable program, ISP, or Google doing it.
Really hard to check OE on a GNU/Linux. Does it work with 'Wine'?

<G>
Maybe *you* should use OE and AT&T!! [ got buck$? ]
( .... and 'hand quote' James' messages, like I do. ;-{ )
</G>

Maybe when converting '\n' they are stripping out trailing whitespace too.
This line has five spaces after the period.

--
Bob R
POVrookie
Jun 20 '07 #26
On Jun 21, 1:03 am, "BobR" <removeBadB...@ worldnet.att.ne twrote:
Default User <defaultuse...@ yahoo.comwrote in message ...
Default User wrote:
I'm actually posting this from Google Groups. I'll add a manual .sig
and see how it looks to me with my regular newsreader.
--
Manual signature, dash dash space entered by hand.
I don't see this as a correct .sig either.
Slaughtered here too.
I have checked my own OE generated sig. uploaded to my ISP, and back == OK.
So, it is another 'news' capable program, ISP, or Google doing it.
Really hard to check OE on a GNU/Linux. Does it work with 'Wine'?
<G>
Maybe *you* should use OE and AT&T!! [ got buck$? ]
( .... and 'hand quote' James' messages, like I do. ;-{ )
</G>
Maybe when converting '\n' they are stripping out trailing whitespace too.
This line has five spaces after the period.
Not when I copy/paste it from Google news into my editor:-). It
has no spaces, where as the sig separator has one trailing
space.

The space in the .sig is probably there, in the messages
circulating in NNTP, but there is definitely some funny stuff
going on.

--
James Kanze (GABI Software, from CAI) email:ja******* **@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientier ter Datenverarbeitu ng
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34

Jun 21 '07 #27
BobR <re***********@ worldnet.att.ne twrote:
I have checked my own OE generated sig. uploaded to my ISP, and back == OK.
[sig quoted intentionally]
--
Bob R
POVrookie
Hmm, your .sig delimiter is missing the space when I read it here. Many
other posts do not have this problem, so I don't think it's on my end.

The funny thing is that I *have* seen *some* of your posts with a
correct delimiter.
Maybe when converting '\n' they are stripping out trailing whitespace too.
This line has five spaces after the period.
Could be. When reading over here, there are no spaces after the period.

--
Marcus Kwok
Replace 'invalid' with 'net' to reply
Jun 21 '07 #28
BobR wrote:
>
Default User <de***********@ yahoo.comwrote in message ...
Default User wrote:
I'm actually posting this from Google Groups. I'll add a manual
.sig and see how it looks to me with my regular newsreader.
--
Manual signature, dash dash space entered by hand.
I don't see this as a correct .sig either.
>
Slaughtered here too.
Hard to tell how widespread it is, as most GG users don't have .sigs.
<G>
Maybe you should use OE and AT&T!! [ got buck$? ]
Good grief, no.
( .... and 'hand quote' James' messages, like I do. ;-{ )
Well, I just have to trim the .sig manually, rather than have XanaNews
do it for me.
</G>

Maybe when converting '\n' they are stripping out trailing whitespace
too. This line has five spaces after the period.
I don't see that.
--
Bob R
POVrookie
Yours is missing the space in the .sig separator as well.


Brian
Jun 21 '07 #29

Marcus Kwok wrote in message...
BobR <re***********@ worldnet.att.ne twrote:
I have checked my own OE generated sig. uploaded to my ISP,
and back == OK.
Followup: To you and James [ I see default users post, will load on this
post]

I checked my outgoing posts (before send), and OE(5) *IS* stripping, but it
depends on the post I am replying to. I tried changing the 'encoding', no
soap.

Very strange. I may be forced to find a 'bootleg' OE6, and hope it will work
with win98se (the last ms for me! Debian!).
[sig quoted intentionally]
--
Bob R
POVrookie

Hmm, your .sig delimiter is missing the space when I read it here. Many
other posts do not have this problem, so I don't think it's on my end.

The funny thing is that I *have* seen *some* of your posts with a
correct delimiter.
Maybe when converting '\n' they are stripping out trailing whitespace
too.
This line has five spaces after the period.

Could be. When reading over here, there are no spaces after the period.
Here either. (stripped before I sent it. ;-{ )
>
[sig quoted intentionally]
--
Marcus Kwok
Yet, your sig is good here.

Did Gates do it to us again?
( ms: Send money, get upgrade. Buy 'vista' for a million bucks, or suffer a
horrible death! <G( Dictatorships and monopolys, BAH humbug!) )

--
Bob R
POVrookie
Jun 21 '07 #30

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

Similar topics

3
9687
by: Rakesh | last post by:
In my Python code fragment, I want to write a code fragment such that the minimum element of a tuple is subtracted from all the elements of a given tuple. When I execute the following python script I get the following interpreter error.
6
12546
by: c++newbie | last post by:
Hi all, I try to compile the following classes: main.cpp: #include <algorithm> #include <iostream> #include <fstream> #include <iterator>
4
4779
by: bor_kev | last post by:
Hi! What's the syntax to overload the operator= under Microsoft Visual C++ .NET 2005 in a managed class. I tried : static Myclass^ op_Assign (Myclass^, Myclass^){} but it doesn't work. don't know why....
2
5366
by: michael.rygh | last post by:
This is just one of the sources for a project that deals with a library. I am having problems, here is the errors. all these.. i belive it has something to do with it needs a subscript? but i'm not exactly sure what to do.. (33): error C2679: binary '>>' : no operator found which takes a right-hand operand of type 'char ' (or there is no acceptable conversion) 37): error C2679: binary '>>' : no operator found which takes a
1
31086
by: Florian Lindner | last post by:
Hello, I get the exception above when trying to use a float as radix and exponent, e.g.: Traceback (most recent call last): File "<stdin>", line 1, in ? TypeError: unsupported operand type(s) for ^: 'float' and 'float' How can I use floats for powers?
4
5470
by: lothas | last post by:
Hi, I'm working on a project to create a robotics simulation environment based on c++ and opengl. Right now I'm stuck trying to solve a compilation error that I'm getting while trying to push_back an object from one of my classes. Here's part of the code: class RobotStruct { public: RobotStruct(); virtual ~RobotStruct(); void AddJoint(float Theta, float Alpha, float a, float d, int Type); void PopJoint(int ID) {...
1
2781
by: Terry Archer | last post by:
Error 1 error C2679: binary '>>' : no operator found which takes a right-hand operand of type 'std::string' (or there is no acceptable conversion) #include <iostream> #include <fstream> #include <iomanip> using namespace std; int main() { string lastName1, firstName1, lastName2, firstName2, lastName3, firstName3; double currentSalary1, currentSalary2, currentSalary3;
0
9399
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10161
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
8831
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...
1
7378
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5275
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...
0
5421
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3924
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
3531
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2806
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.