[UP]


Manual Reference Pages  - filewrite (3)

NAME

filewrite(3f) - [M_io] 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) 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 ">>" STATUS changes to "UNKNOWN" and the default POSTION 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 of 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


filewrite (3) March 11, 2021
Generated by manServer 1.08 from 2ed4bfbe-b847-467f-b5b6-ff31eef34cf4 using man macros.