Skip to content
Snippets Groups Projects
Commit 5b57c2c3 authored by Qianqian Fang's avatar Qianqian Fang
Browse files

assume binary files when saving and loading a ubjson

git-svn-id: http://svn.code.sf.net/p/iso2mesh/code/trunk/jsonlab@417 786e58fb-9377-0410-9ff7-e4ac0ac0635c
parent 979b5e39
Branches
Tags
No related merge requests found
...@@ -33,8 +33,8 @@ global pos inStr len esc index_esc len_esc isoct arraytoken ...@@ -33,8 +33,8 @@ global pos inStr len esc index_esc len_esc isoct arraytoken
if(regexp(fname,'[\{\}\]\[]','once')) if(regexp(fname,'[\{\}\]\[]','once'))
string=fname; string=fname;
elseif(exist(fname,'file')) elseif(exist(fname,'file'))
fid = fopen(fname,'rt'); fid = fopen(fname,'rb');
string = fscanf(fid,'%c'); string = fread(fid,inf,'uint8=>char')';
fclose(fid); fclose(fid);
else else
error('input file does not exist'); error('input file does not exist');
......
...@@ -108,7 +108,7 @@ end ...@@ -108,7 +108,7 @@ end
% save to a file if FileName is set, suggested by Patrick Rapin % save to a file if FileName is set, suggested by Patrick Rapin
if(~isempty(jsonopt('FileName','',opt))) if(~isempty(jsonopt('FileName','',opt)))
fid = fopen(opt.FileName, 'wt'); fid = fopen(opt.FileName, 'wb');
fwrite(fid,json,'char'); fwrite(fid,json,'char');
fclose(fid); fclose(fid);
end end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment