0

I have very strange error and EclipseADT behaviour, when I use read and write function from . It's my code:

std::ifstream infile ("test.txt",std::ifstream::binary);
std::ofstream outfile ("new.txt",std::ofstream::binary);

// get size of file
infile.seekg (0,infile.end);
long size = infile.tellg();
infile.seekg (0);

// allocate memory for file content
char* buffer = new char[size];

// read content of infile
infile.read (buffer,size);

// write to outfile
outfile.write (buffer,size);

// release dynamically-allocated memory
delete[] buffer;
outfile.close();
infile.close();

When I try to build this code, I have error in Eclipse ADT: Invalid arguments 'Candidates are: stlpmtx_std::basic_istream> & read(char *, ?)'

However project build successful, and I have my .apk file. Eclipse shows this message: "Your project contains error(s), please fix them before running your application" I can't run my apk on device or emulator automatically. I tried to clear and delete/open my project, I tried to use this function in sample project, but I also had this error.

Tell me please, what I do wrong?

Engine version: cocos2d-x-2.2.0 OS: Windows 7 IDE: Eclipse ADT Build: v22.2.1-833290

  • May be these will help you out, http://stackoverflow.com/questions/19534197/android-ndk-development-issue-invalid-arguments-error-for-memcpy-function http://stackoverflow.com/questions/11375287/openssl-invalid-arguments-candidates-are-int-bn-set-wordbignum-st http://stackoverflow.com/questions/17234644/c-invalid-arguments-candidates-are-on-setters-from-different-classes So my guess is, either you have missed an "inlcude" or you are doing something similar to these links I have given. – Syed Mauze Rehan Apr 23 '14 at 16:43
  • Thanks a lot, this sample solves my problem! – user3564974 Apr 24 '14 at 06:36

0 Answers0