简体   繁体   中英

vector to const uint16_t * type

I'd like to use libmodbus for my custom project. Everything works fine with predefined static values, but i cannot use modbus_write_registers function with the fourth parameter const uint16_t *'src' predefined dynamically.

In practice I have to convert obtained DB values to a such kind of type, do not know how.

Any hints?

假设您具有std::vector<uint16_t> ,则可以使用std::vector<uint16_t>::data() (在本示例中将返回uint16_t * )作为指针访问基础内存缓冲区。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM