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<char,struct std::char_traits<char>,class std::allocator<char> >::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.

Recommended Answers

All 2 Replies

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

Nope thats not the problem thanks tho

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.