I'm getting compile errors on ubuntu when compiling the following code
unsigned char* pBytes = new unsigned char[10000];
//code to fill pBytes with random characters
//pFile is of type FILE* obtained from opening a file.
size_t bytesWritten = fwrite(pBytes, 1, 10000, pFile);
I get the following error:
Invalid arguments '
Candidates are:
? fwrite(const void *, ?, ?, _IO_FILE *)
' Write.cpp /FileTest/src line 55 Semantic Error
I get a similar error with fread():
unsigned char* seqData = new unsigned char[10000];
size_t result = fread(seqData, 1, 10000, pFile);
Invalid arguments '
Candidates are:
? fread(void *, ?, ?, _IO_FILE *)
' Write.cpp /FileTest/src line 65 Semantic Error
I get a similar error with gethostname()
char name[50];
gethostname(name, sizeof(name));
Candidates are:
int gethostname(char *, ?)
' Write.cpp /FileTest/src line 77 Semantic Error
Last edited on
You show the code for fwrite but the error is about fread.
Can you give a small example that compiles with the error that you want to show?
Updated post.
The fwrite, fread code builds fine on Windows.