Operating System - Linux
1828633 Members
1960 Online
109983 Solutions
New Discussion

aCC 3.70 and C I/O functions

 
SOLVED
Go to solution
Craig Smith_13
Frequent Advisor

aCC 3.70 and C I/O functions

I have serveral C functions that I would like to use in my C++ program (without having to rewrite them) that contain functions such as access(), open(), read(), write(), etc. It compiles fine, but returns a -1 when using access() or open().
It has no problems with fread...

Any ideas?

Thanks.
3 REPLIES 3
Dennis Handly
Acclaimed Contributor
Solution

Re: aCC 3.70 and C I/O functions

As long as you use the appropriate system header file, you should should be able to use stdio or other libc functions in C++.

If access(2) or open(2) return -1, you should be looking at errno to see what's wrong. You can use strerror(3) to decode errno.

Make sure you include .
Craig Smith_13
Frequent Advisor

Re: aCC 3.70 and C I/O functions

Thanks for the response, yes I was using perror().

Found problem, changed base directory from old /users user directory to /home in new version and needed to be changed in the old C code.

Dennis Handly
Acclaimed Contributor

Re: aCC 3.70 and C I/O functions

Oops, a typo in my reply above:
Make sure you include or .