作者dozer (rezod)
看板LinuxDev
标题[问题] I/O in C
时间Tue Nov 28 15:44:02 2006
想要在一个用fopen打开的档案中
插入一行字
比如说 原本的档案长这样
first line
second line
@
lastline
想要在@前面加入一行 third line, i.e.
first line
second line
third line
@
lastline
有没有除了全部读到buffer里面 再重新写入之外的方法哩
因为那样就不能处理很大的档案了...
--
It is a hard matter, my fellow citizens, to argue with the belly,
since it has no ears.
-- Marcus Porcius Cato
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 140.109.176.56
1F:推 kkdlin:sed?? 用system去call 11/28 16:12
2F:推 dozer:有没有办法全部用C 11/28 16:14
3F:→ dozer:因为想尽量跨平台... 11/28 16:14
4F:→ bullfrogtwn:buffer 应该是 libc 内部去实做的,这边应该只要对 11/29 00:17
5F:→ bullfrogtwn:读入和写出的 file pointer 做处理即可 ... ? 11/29 00:18
6F:推 dozer:噢我说的buffer是自己开的char[] :P 11/29 21:40