malloc 与 uint8_t 之间的区别
这里是C语言新手。我不确定通过 malloc 向文件分配内存和执行操作之间的区别。
typedef uint8_t BYTE;
BYTE filename[//number of bytes]
例如,读取文件的开头并检查 jpeg,我们使用后者来检查其“签名”的前 4 个字节。这涉及到“fread”函数,以便读取前 4 个字节并将其临时存储在称为文件名的地方。我不会对 malloc 做同样的事情吗?不确定两者之间的确切区别是什么。
提前感谢大家回答我的问题!
newbie to C language here. I am not sure of the difference between allocating memory to a file through malloc, and doing
typedef uint8_t BYTE;
BYTE filename[//number of bytes]
For instance reading the start of a file and checking for jpeg, we are using the latter to check for the first 4 bytes for its "signature". This involves "fread" function in order to read the first 4 bytes and temporarily store it in this place called filename. Won't I be doing the same thing with malloc? Not sure what is the exact difference between the 2.
Thanks everyone in advance for answering my question!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论