How to specify which function I want to use in a C++ class when a C function has the same name as my C++ function?

Viewed 46

I am trying to write an i2c driver class. The class contains read() and write() methods. The problem is that I use write function of unistd.h in my Drv_i2c class write() function (see below) and Qtcreator compiler chooses my class write function instead of unistd.h write function.

I know that I could just rename my class function but is it possible to specify that I want to use unistd.h write function? (Same for read function)

    bool Drv_i2c::write(uint8_t p_i2c_address, uint8_t p_reg, const std::vector<uint8_t> 
    &p_data)
    {
        [...]

        /* Checking that all data has been written */
        if(write(this->s_fd_i2c, l_buffer, l_buf_length) != l_buf_length)
        {
            //  ERROR HANDLING: i2c transaction failed
            l_result = false;
        }
        [...]
    }
1 Answers

You can use the scope operator "::" maybe

Related