gpt4 book ai didi

c++ - 你能帮我清除这个错误吗

转载 作者:太空宇宙 更新时间:2023-11-04 16:13:17 25 4
gpt4 key购买 nike

fstream file(Fname,ios::in|ios::binary);

pharmacy_personnel ob;
while(file.read((char*)ob,sizeof(ob)))
{
total++;
}

这是我的代码的一小部分。它给出了一个错误:

"no suitable conversion function from "pharmacy_personnel" to "char *" exists"

请告诉我哪里做错了。

最佳答案

您缺少 &(地址)运算符。

file.read((char *)&ob, sizeof ob)

关于c++ - 你能帮我清除这个错误吗,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25674822/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com