Passing by reference.
This is the basic of basics, but for some reason I keep getting the compile error
error C2143: syntax error : missing ')' before '&'
All I wanted to do was change the file_read function so that it returned an number for error (or success) and stored the number of bytes read through a variable passed to it.
int file_read(ang_file *f, _TCHAR *buf, size_t n, size_t &n_read)
... function goes here ...
I'm new to C++ programming so if I've missed something very obvious please let me know.
that error usually means it doesn't recognize a type in your arg list
what did the function look like before?
Originally Posted by m37h0d
as far as I recall. There are other size_t's and _TCHAR's in the same file so I'd be surprised if they were the problem.
int file_read(ang_file *f, _TCHAR *buf, size_t n)
Yeah, it's definitely the & that isn't being liked there. Changing everything else doesn't kill the compile error.
>> Yeah, it's definitely the & that isn't being liked there. Changing everything else doesn't kill the compile error.
Why don't you post a small, compilable example that demonstrates the problem?
Are you compiling the code as C code (i.e., does the name of the file end in ".c")? Because C doesn't have references.
D'oh! Yeah, it's "Compile as C++ Code (/TP)" but .c files. I forgot about that.
Originally Posted by dwks