replace a line of a file

6 ビュー (過去 30 日間)
oblivious
oblivious 2012 年 6 月 5 日
Hello,
we know that we can read the lines of a file by using fgetl or fgets. But i need a function that will replace the lines of a file by a string, just the opposite thing of fgetl. is there such a function? doing this work manually is tedious, so i need such a function. please help
-OBLI

採用された回答

per isakson
per isakson 2012 年 6 月 5 日
It might be possible to do it inplace with memmapfile. If the lines are the same length, etc. I would not try. Try
loop over all lines
fgetl
if
fprintf
else
fprintf
end
end
to a new file
  1 件のコメント
oblivious
oblivious 2012 年 6 月 5 日
thanks a lot

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeText Files についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by