Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
6.0.2 - Português

Change language to:
English - Français - 日本語 - Русский

Please note that the recommended version of Scilab is 2024.0.0. This page might be outdated.
See the recommended documentation of this function

Ajuda do Scilab >> Arquivos : funções de Entrada/Saída > merror

merror

tests the file access errors indicator

Syntax

err = merror([fd])
[err, msg] = merror([fd])

Arguments

fd

a scalar: the fd parameter returned by the function mopen is used as a file descriptor (it's a positive integer). -1 stands for last opened file. The default value is -1.

err

a scalar: an error status number of the most recent file I/O operation associated with the specified file.

If the most recent I/O operation performed on the specified file was successful, the value of msg is empty and merror returns an err value of 0.

msg

a string: an error string message.

Description

The function merror is used to test the file access errors indicator returning non-zero if it is set. The error indicator can only be reset by the mclearerr function.

A nonzero err indicates that an error occurred in the most recent file I/O operation. The value of message is a string that can contain information about the nature of the error. If the message is not helpful, consult the C run-time library manual for your host operating system for further details.

Examples

fd = mopen(TMPDIR +'/filetxt.txt','wt');
[err,msg] = merror(fd)
if (err <> 0) then
  mprintf('Problem\n');
end
mclose(fd);

See also

  • mclearerr — resets binary file access errors
  • mclose — closes an opened file
  • mopen — opens a file in Scilab
  • mput — writes byte or word in a given binary format
  • mget — reads byte or word in a given binary format and converts to a double type
  • mgetstr — reads a character string from a file
  • mputstr — writes a character string in a file
  • meof — checks if end of file has been reached
  • mseek — sets current position in a binary file
  • mtell — Returns the offset of the current byte relative to the beginning of a file
Report an issue
<< meof Arquivos : funções de Entrada/Saída mfprintf >>

Copyright (c) 2022-2023 (Dassault Systèmes)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Thu Feb 14 15:00:46 CET 2019