CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2009
    Posts
    52

    Urgent:fstream error

    Code:
    void returnDirSize(int& size)
    {
    	string s1,s2,s3;
    	ifstream inp;
    	ofstream output;
                    inp.open("dir.txt");
                    
                    if(!inp)
    	{	
                         cout<<"unable to open"<<endl;
    	     exit(1);
    	}
    	while(inp >> s1 >> s2 >> s3)
                   {
    	      size++;
    	}
    	inp.close();
    }
    It shows an error:
    binary '>>' : no operator found which takes a right-hand operand of type 'std::string' (or there is no acceptable conversion).
    It works fine elsewhere
    Thank you
    Last edited by mohit.choudhary; October 17th, 2009 at 03:25 PM.

  2. #2
    Join Date
    Sep 2009
    Posts
    52

    Re: Urgent:fstream error

    Sorry got it. forgot to include string.h

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured