# Thread: stringstream problem

1. ## stringstream problem

I'm trying to insert a string into my stringstream but I'm getting errors. Any thoughts?

Code:
```//Dustin Nicholes
//CS 240

#include "stopWord.h"
#include "URL.h"
#include <fstream>
#include <iostream>
#include <sstream>
#include <stdlib.h>
using namespace std;

int main(int argc, char* argv[])
{
//Get the arguments from the command line
string startURL(argv[1]);
string outputFile(argv[2]);
string stopFile(argv[3]);

//Send the start URL to a class that determines if it is HTML and can also do things like determine the Absolute URL
//This is also where the robot filiter is started from
URL url(startURL);

//Open the stop words file
fstream file;
file.open(stopFile.c_str());
stopWord::stopWord(file);

//Setup the structure that will contain unprocessed URLs
stringstream URLsToProcess;
URLsToProcess<<startURL;    //THIS LINE WON'T WORK!!

//While we still have unprocessed URLs, Process them!
string currentURL;
while(currentURL<<URLsToProcess)
{
//Create a class that can parse the words, headers, new URLs, etc...
PageParser parser(currentURL, stopWords);

/*
//Create a new page
Page* page = new Page(parser);
if(pages doesn't contain this new page already)
{
//Add the new page to the data structure containing all of the processed pages
//Retrieve all of the new URLs from the page and add them to the pseudo queue
URLsToProcess<<parser.getNewURLs;
}
*/
}

//Write the file to XML
std::ofstream outFile(outputFile);
//XMLwriter output(pages, startURL);
//output.writeOut(outFile);

return 0;
}```

2. If it helps, here is one of several errors issued by the compiler

Code:
```driver.cpp(35) : 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'
1>        c:\program files\microsoft visual studio 9.0\vc\include\string(537) : see declaration of 'std::operator <<'```

3. This is not C.

BTW, the reason for the error is probably that you haven't #include'd the <string> header.

4. My apologies. A bien tot!

Popular pages Recent additions