嗨,请帮助C代码“如何通过块”读取C目录块中的文本文件“ [英] Hi please help with C code for "how to read a text file in C directory chunk by chunk"

查看:59
本文介绍了嗨,请帮助C代码“如何通过块”读取C目录块中的文本文件“的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用xlinx编译器,有人请帮忙,如何从c:\目录块中读取文本文件块。



我是什么尝试过:



i在我自己尝试过但是没有工作

i am using xlinx compiler, someone please help out , how to read text file from c:\ directory chunk by chunk .

What I have tried:

i tried in myself but its not working

推荐答案

参见 fread | Microsoft Docs [ ^ ]。


从您可以在此处找到的示例代码开始: fread - C ++参考 [ ^ ] 。根据您的需要修改它(提示:给定文件长度 lSize 和块长度 lChunkSize ,你必须阅读(lSize / lChunkSize)完整的块,加上(lSize%lChunkSize)备用字节)。

请注意,在现代 Windows OS 版本中,不允许使用标准用户程序写入 C:\ folder。
Start with the sample code you may find here: fread - C++ Reference[^]. Modify it according to your needs (hint: given the file length lSize and the chunk length lChunkSize, you have to read (lSize/lChunkSize) full chunks, plus (lSize % lChunkSize) spare bytes).
Please note, on modern Windows OS versions, a standard user program is not allowed to write in C:\ folder.


如果您正在为Xilinx嵌入式系统编写代码,它将无法工作,因为 c:\directory 是Windows(或DOS)路径(可能在您的开发主机上)。



要访问此类嵌入式系统上的文件,您需要存储硬件(例如HDD,SD卡)和系统上运行的操作系统,该驱动程序为硬件和使用的文件提供驱动程序系统(s)。



如果您需要将文件数据从开发主机传输到嵌入式系统,您可以使用通信接口(例如UART /串行或网络)并实现代码来处理传输和处理收到的数据。



我无法提供进一步的帮助,因为你没有给我们任何关于你的项目的信息(硬件和用过的系统软件)。对于非常具体的请求,最好在专门的论坛中提问,例如 Xilinx:主页 - 社区论坛 [ ^ ]。
It won't work if you are writing code for a Xilinx embedded system because c:\directory is a Windows (or DOS) path (probably on your development host).

To access files on such embedded systems you need storage hardware (e.g. HDD, SD card) and an OS running on the system that provides drivers for hardware and the used file system(s).

If you need to transfer file data from your development host to an embedded system you can use a communication interface (e.g. UART/serial or network) and implement code to handle the transfer and process the received data.

I can't give further help because you did not gave us any information about your project (hardware and used system software). For such very specific requests it might be also better to ask in a dedicated forum like Xilinx: Home - Community Forums[^].


这篇关于嗨,请帮助C代码“如何通过块”读取C目录块中的文本文件“的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆