How delete file from fortran code?

后端 未结 5 1451
有刺的猬
有刺的猬 2021-02-14 00:21

I need to delete a file from a Fortran code. I am on ubuntu 12.04, x86_64. I don\'t understand why the procedure described below does not work. Please

5条回答
  •  闹比i
    闹比i (楼主)
    2021-02-14 01:11

    Why not let Fortran do the work for you? This code is portable (compare cup's comment):

    open(unit=1234, iostat=stat, file=file, status='old')
    if (stat == 0) close(1234, status='delete')
    

提交回复
热议问题