I'm programming a serial port on Unix, and I'm using the header file unistd.h
. It contains the function:
read(int fd, void *buf, size_t count)
I'm making a class to call this function, and one of the methods in my class is also called read()
to read one character. But when I compile, it says it cannot identify the function read()
from unistd.h
. If I was using C++, I could just add ::
to resolve library conflict. How to resolve a library conflict when I'm using C++ and calling C library functions?
Later when a developer uses my library it would be simple and neat as follows:
Serial serial;
serial.read();
My class name is Serial
and contains the method read()
, which itself calls the function read()
from unistd.h
.