Thread: stringstream problem

  1. #1
    Registered User
    Join Date
    Dec 2006

    stringstream problem

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

    //Dustin Nicholes
    //CS 240
    //LinkedList driver class
    #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;;
    	//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;
    		//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
    	//Write the file to XML
    	std::ofstream outFile(outputFile);
    	//XMLwriter output(pages, startURL);
    	return 0;

  2. #2
    Registered User
    Join Date
    Dec 2006
    If it helps, here is one of several errors issued by the compiler

    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. #3
    Registered User hk_mp5kpdw's Avatar
    Join Date
    Jan 2002
    Northern Virginia/Washington DC Metropolitan Area
    This is not C.

    BTW, the reason for the error is probably that you haven't #include'd the <string> header.
    "Owners of dogs will have noticed that, if you provide them with food and water and shelter and affection, they will think you are god. Whereas owners of cats are compelled to realize that, if you provide them with food and water and shelter and affection, they draw the conclusion that they are gods."
    -Christopher Hitchens

  4. #4
    Registered User
    Join Date
    Dec 2006
    My apologies. A bien tot!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. stringstream to float problem
    By c0d3m0nk3y in forum C++ Programming
    Replies: 10
    Last Post: 02-01-2008, 04:07 AM
  2. Memory problem with Borland C 3.1
    By AZ1699 in forum C Programming
    Replies: 16
    Last Post: 11-16-2007, 11:22 AM
  3. Someone having same problem with Code Block?
    By ofayto in forum C++ Programming
    Replies: 1
    Last Post: 07-12-2007, 08:38 AM
  4. A question related to strcmp
    By meili100 in forum C++ Programming
    Replies: 6
    Last Post: 07-07-2007, 02:51 PM
  5. WS_POPUP, continuation of old problem
    By blurrymadness in forum Windows Programming
    Replies: 1
    Last Post: 04-20-2007, 06:54 PM