如何用C++修改文件的内容
PHPz
PHPz 2017-04-17 13:47:18
0
2
605

我想实现对已有文件中的部分内容的修改,比如文件中的"abcdef"我想修改为"cbadef",其余位置的文件内容不做更改,并且将结果存到原文件中,请问应该如何操作?

PHPz
PHPz

学习是最好的投资!

reply all(2)
小葫芦
  1. Just rewrite it, it will overwrite the original

  2. every time
  3. Use the lseek(int filedes, off_t offset, int whence) function to operate with the offset of the file pointer

阿神

To overwrite without changing the file length, just lseek directly

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!