Revision 2ce396a76821d352b608cbcadbb6c57de59620c3 authored by Alec Jacobson on 08 January 2020, 05:26:22 UTC, committed by Alec Jacobson on 08 January 2020, 05:26:22 UTC
1 parent 9d0a7c0
eat_comments.m
function line = eat_comments(file_pointer,comment_symbol)
% EAT_COMMENTS use fscanf to eat lines starting with a comment_symbol
%
% line = eat_comments(file_pointer,comment_symbol)
%
% Inputs:
% file_pointer returned from fopen
% comment_symbol symbol of comment, e.g. '#'
% Output:
% line next line that does not start with a comment_symbol
% (file_pointer is correspondingly adjusted)
%
assert(size(comment_symbol,2) == 1);
while(true)
% read next whole line
line = fscanf(file_pointer,' %[^\n]s');
if(size(line,2) == 0)
break;
elseif(line(1,1) ~= comment_symbol)
break;
end
end
end
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...