C Library Functions  - filewrite (3)

NAME

filewrite(3f) - [M_io:WRITE] A simple write of a CHARACTER array to a file (LICENSE:PD)

CONTENTS

Synopsis
Description
Option
Returns
Example
Author
License

SYNOPSIS

function filewrite(filename,data,status,position) result(ierr)

     character(len=*),intent(in) :: filename
     character(len=*),intent(in) :: data(:)
     character(len=*),intent(in),optional :: status
     character(len=*),intent(in),optional :: position
     integer                     :: ierr

DESCRIPTION

A convenience procedure for writing a CHARACTER array as a new file.

OPTION

FILENAME
  file to create or write. If the name ends in ">" the default for STATUS changes to "REPLACE". If it ends in ">>" STATUS changes to "UNKNOWN" and the default POSITION changes to "APPEND".
DATA CHARACTER array to write to file
STATUS STATUS to use on OPEN(7f). Defaults to "NEW".
Allowed values are
  NEW|REPLACE|OLD|SCRATCH|UNKNOWN
POSITION
  POSITION to use on OPEN(7f). Defaults to "REWIND".
Allowed values are
  ASIS|REWIND|APPEND

RETURNS

IERR status value. Zero indicates no error occurred

EXAMPLE

Sample program:

    program demo_filewrite
    use M_io, only : filewrite
    implicit none
    integer :: ierr
    character(len=:),allocatable :: data(:)
       data=[ character(len=80) :: &
            &’This is the text to write  ’, &
            &’into the file. It will be  ’, &
            &’trimmed on the right side. ’, &
            &’ ’, &
            &’     That is all Folks!    ’, &
            &’’]
       ierr=filewrite(’_scratch.txt’,data)
    end program demo_filewrite

AUTHOR

John S. Urban

LICENSE

Public Domain


Nemo Release 3.1 filewrite (3) July 22, 2023
Generated by manServer 1.08 from 22faceed-1da8-4f88-9a6e-767c18df6a10 using man macros.