c++


how to fix this file stream warning?


I come from Java and I don't know why my C++ compiler is giving me a warning.
#include <fstream>
#include <iostream>
using namespace std;
class File {
public:
File();
File(const File& orig);
virtual ~File();
void leggi();
private:
fstream file;
};
If I want to associate the reference to a new object, I do this:
void File::leggi() {
file = fstream("file.txt", fstream::in);
if (!file) {
cout << "create file before!";
return;
}
file.close();
return;
}
File.cpp:30:10: note: implicit copy assignment operator for 'std::__1::basic_fstream<char, std::__1::char_traits<char> >' first required here"
What can I do?

Related Links

Using boost::asio::async_wait_until with boost::asio::streambuf
Frame rate inconsistent between runs of OpenGL software
Creating json string using json lib
Can I know which exception was thrown inside a gtest EXPECT_NO_THROW (or ASSERT_NO_THROW)?
how to use CDB debugger in Qt Creator
Makefile Confusion
C++ Programm Exe creates Error when starting
How to call copy constructor of all base classes for copying most derived class object in diamond inheritance in C++?
Why aren't all the variable in .cpp file in the .h file? [closed]
c++ Simple makefile advice
Click action on QListWidget
Issue specifying option while using Emscripten (Emcmake)
Keeping state of DataFrame between cython calls
LibPNG segmentation fault on png_read_image
C++ | Method scope pointer management
How to organize includes for a header-only library that wants to expose mutually recursive functions?

Categories

HOME
composer-php
knn
iframe
drools
informix
appium
datatable
amazon-redshift
google-places-api
instagram-api
aurelia-router
apache-apex
rpres
visio
salt-stack
axon
drupal-modules
nlog
intercept
fgets
mysql-error-1064
qtspim
workspace
http-caching
cropper
vowpalwabbit
ext4
fread
live
gearman
appery.io
google-optimize
dos
powerdns
fitnesse-slim
nerdtree
ats
cics
behavior
gitversion
case-class
c++1z
autocompleteextender
icingaweb2
prime-factoring
google-keep
greenlets
gyp
code-signing-entitlements
canonical-link
pubsubhubbub
strstream
nested-function
kendo-datepicker
dotpeek
nibble
ntfs-3g
stunnel
angular-ui-tree
authentication-flows
materialized-views
elasticsearch-marvel
apache-roller
eazfuscator
visual-studio-2010-sp1
apache-wink
zooming
uploadifive
avaloq-script
function-prototypes
swift-protocols
accessdatasource
control-center
android-handlerthread
ntl
controltemplate
texmacs
dynamic-html
inference
stencils
postfix-operator
rs485
kendo-tooltip
mib
mathtype
dynamic-language-runtime
operational-transform
ejbql
nsformatter
ora-01426
twisted.internet
iasyncresult
windows-live-writer
httpverbs
dynamic-css
tibco-gi
codehighlighter
sqlmetal

Resources

Encrypt Message



code
soft
python
ios
c
html
jquery
cloud
mobile