Skip to content

Commit 3ef423c

Browse files
committed
add doc of getcwd
1 parent 90832ea commit 3ef423c

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

flang/docs/Intrinsics.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -967,4 +967,34 @@ program test_etime
967967
print *, tarray(1)
968968
print *, tarray(2)
969969
end program test_etime
970+
```
971+
972+
### Non-Standard Intrinsics: GETCWD
973+
974+
#### Description
975+
`GETCWD(C, STATUS)` returns current working directory.
976+
977+
This intrinsic is provided in both subroutine and function forms; however, only one form can be used in any given program unit.
978+
979+
*C* and *STATUS* are `INTENT(OUT)` and provide the following:
980+
981+
| | |
982+
|------------|---------------------------------------------------------------------------------------------------|
983+
| `C` | Current work directory. The type shall be `CHARACTER` and of default kind. |
984+
| `STATUS` | (Optional) status flag. Returns 0 on success, a system specific and nonzero error code otherwise. The type shall be `INTEGER` and of a kind that greater or equal to 4. |
985+
986+
#### Usage and Info
987+
988+
- **Standard:** GNU extension
989+
- **Class:** Subroutine, function
990+
- **Syntax:** `CALL GETCWD(C, STATUS)`, `STATUS = GETCWD(C)`
991+
992+
#### Example
993+
Here is an example usage from [Gfortran GETCWD](https://gcc.gnu.org/onlinedocs/gfortran/GETCWD.html)
994+
```Fortran
995+
PROGRAM test_getcwd
996+
CHARACTER(len=255) :: cwd
997+
CALL getcwd(cwd)
998+
WRITE(*,*) TRIM(cwd)
999+
END PROGRAM
9701000
```

0 commit comments

Comments
 (0)