function out=fileread(filename)
%MATLAB Code Generation Library Function

%#codegen
% Copyright 2019 The MathWorks, Inc.

narginchk(1, 1);

filename = convertStringsToChars(filename);

coder.internal.errorIf(~ischar(filename), 'MATLAB:fileread:filenameNotString');
coder.internal.errorIf(isempty(filename), 'MATLAB:fileread:emptyFilename')

fid = fopen(filename);
coder.internal.errorIf(fid == -1, 'Coder:toolbox:FileReadBadFile', filename);
fidCleaner = onCleanup(@()(fclose(fid)));

out = fread(fid,'*char')';