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

Change language to:
English - Français - 日本語 -

Please note that the recommended version of Scilab is 2024.1.0. This page might be outdated.
However, this page did not exist in the previous stable version.

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


Emulator of C language fprintf function

Calling Sequence




a Scilab string. Specifies a character string combining literal characters with conversion specifications.


Specifies the data to be converted according to the format parameter.


column vector of character strings


a Scilab string specifying a file name or a logical unit number (see file)

Note that is file=0, the message will be display on standard error stream (stderr).


Obsolete function, use preferabily the mfprintf function which is much more compatible with the C fprintf functionalities.

The fprintf function converts, formats, and writes its value parameters, under control of the format parameter, to the file specified by its file parameter.

The format parameter is a character string that contains two types of objects:

Literal characters

which are copied to the output stream.

Conversion specifications

each of which causes zero or more items to be fetched from the value parameter list. see printf_conversion for details

If any values remain after the entire format has been processed, they are ignored.


u=file('open','results','unknown') //open the result file
for tk=t
  fprintf(u,'time = %6.3f value = %6.3f',tk,sin(tk)) // write a line
file('close',u) //close the result file

fprintf(0,'My error which is going to be displayed on the stderr')

See Also

  • mfprintf — converts, formats, and writes data to a file
  • string — conversão para string (cadeia de caracteres)
  • print — imprime variáveis em um arquivo
  • write — Escrita em arquivo formatado
  • format — impressão de números e formato de exibição
  • disp — exibição de variáveis
  • file — Gerenciamento de arquivos
  • printf — emulador da função da linguagem C printf
  • sprintf — emulador da função da linguagem C sprintf
  • printf_conversion — Especificações de conversão de printf, sprintf, fprintf
<< findfiles Arquivos : funções de Entrada/Saída fprintfMat >>

Copyright (c) 2022-2024 (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 Mar 03 11:00:35 CET 2011