一个文本文件用内存映射打开后,如何一行一行地进行读取? Linux下C语言

2024-11-22 08:34:05
推荐回答(2个)
回答(1):

//mbuf为文件的内存映射地址,buf为昌正你要保码祥存字符串的地址。
char *readline(const char *mbuf, char *buf, int maxlen)
{
int len=0;
while(len {
*(buf+len)=*(mbuf+len);
len++;
}
*(buf+len)='耐模悔\0';
return buf;
}

回答(2):

I am proficient in the z-wave hardware and software development, I was able to provide professional z-wave design. Please contact me: 本人精通z-wave软硬件开发毕悉,开发蠢慧过z-wave一系列产带数答品,如controler,sensor, dimmer等等。如有需要,Please contact me: