What is equivalent mmap into C++?
I have code like below
LCDdata = mmap(NULL, iFrameBufferSize, PROT_READ | PROT_WRITE, MAP_FILE | MAP_SHARED, fb_fd, 0);
Where LCDdata is unsigned char type pointer, iFrameBufferSize is int type and fb_fd is static int type.
When I compile it by use of arm g++ tool chain it give me error as below
error: invalid conversion from 'void*' to 'unsigned char*' [-fpermissive]
So how can I use any equivalent type function instead of mmap?
Which header file I should include? And how this new line's syntax will become?
The C++ equivalent is auto LCDdata = static_cast<unsigned char*>(mmap(...
In C++ we prefer to define out variables only when we initialize them, and because of that we often don't need to specify the type anymore. Here, we don't need to repeat unsigned char*.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With