function status=const_write(x,varname,fname)
% CONST_WRITE writes constant array X as C declaration. 
% Syntax
%       status=const_write(x,fname)
%
% where x is input array, varname is variable name,
%   and fname is file name. 
%
% E. Jovanov, UAH
% September 2008
%

fid=fopen(fname,'wt');
fprintf(fid,'const int %s[]={',varname);
fprintf(fid,'%d,',round(x));
fseek(fid,-1,0);    % one comma too many
fprintf(fid,'};\n');
fclose(fid);
status=length(x);
