Problems with cin::getline [message #831628] |
Thu, 29 March 2012 01:45  |
Eclipse User |
|
|
|
I use CDT Internal Builder and MS Visual C++ Toolchain in my project in Eclipse. The problem is that the compiler swears:
Invalid arguments '
Candidates are:
std::basic_istream<char,std::char_traits<char>> & getline(char *, ?)
std::basic_istream<char,std::char_traits<char>> & getline(char *, ?, char)
'
when I'm tapping something like this:
#include <fstream>
using namespace std;
int main()
{
fstream fin;
char buf[256];
fin.open("in.txt", fstream::in);
fin.getline(buf, 256); // !!!!!
return 0;
}
What is the problem?
|
|
|
|
|
|
|
|
Re: Problems with cin::getline [message #841385 is a reply to message #834716] |
Wed, 11 April 2012 04:29  |
Eclipse User |
|
|
|
Hi,
I don't think a double definition of streamsize can explain an indexer behavior. I ran into the same problem few times already. Using a local instance of Eclipse Indigo on Mac as IDE for Linux RT development make me disappointed with the present CODAN quality. I managed to add remote headers to a project and the indexer took them well from a Linux server. CODAN way making its code analysis also well till the issue of the topic. A very simple example of a code with demonstrates the problem. with b - no error, with orbitTimestamp - wrong argument. Castig is added to enforce somehow CODAN to treat the argument as needed.
uint32_t orbitTimestamp;
char * b;
infile.read(b, sizeof(uint32_t));
infile.[color=red]read[/color](reinterpret_cast<char *>(&orbitTimestamp), sizeof(uint32_t));
IMHO, this is definitely a bug in CODAN.
|
|
|
Powered by
FUDForum. Page generated in 0.04704 seconds