replace a line of a file

조회 수: 1 (최근 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 CenterFile Exchange에서 Large Files and Big Data에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by