954,499 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

fstream

Hey guys i am having a little trouble with this code

# include <fstream>
# include <iostream>
# include <string>
using namespace std;

int main()
{
	fstream filestr;
	filestr.open("text.txt", fstream::in | fstream::out | fstream::app);
	filestr.close();
	return 0;
}


But i keep getting a error when i run it

1> All outputs are up-to-date.
1>Test.obj : error LNK2019: unresolved external symbol __imp___CrtDbgReportW referenced in function "public: char const & __thiscall std::_String_const_iterator,class std::allocator >::operator*(void)const " (??D?$_String_const_iterator@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEABDXZ)

Could someone tell me where i am going wrong and what needs to be changed. Been doing everything to make it work.

slygoth
Light Poster
43 posts since Feb 2011
Reputation Points: 10
Solved Threads: 0
 

I belive the flags you are using should be ios::in | ios::out | ios::app

NathanOliver
Veteran Poster
1,084 posts since Apr 2009
Reputation Points: 215
Solved Threads: 189
 

Nope thats not the problem thanks tho

slygoth
Light Poster
43 posts since Feb 2011
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: