|
|||
|
Hi folks !
End of my wits ![]() My fortran program produces 4 log-files. After these files are closed i want them to have other filenames, like old_name + date + time + ".log". A simple copy would suffice, imho. How can i do that ? And how do i "connect" two strings with each other ? thanks and best regards Alex. |
|
|
||||
|
||||
|
|
|
|||
|
Use the FILENAME functionality of the OPEN statement to give the "proper"
names to those files from the start. There is no (portable) mechanism within a Fortran program to rename a file. If you don't or can't go this way, what you need is a rename at the OS level - i.e., the "mv" command under Unix/Linux or the "ren" command under Windows. Jan |
|
|||
|
In a previous article, =?ISO-8859-1?Q?Jan_Vorbr=FCggen?= <jvorbrueggen-not@mediasec.de> wrote:
>Use the FILENAME functionality of the OPEN statement to give the "proper" >names to those files from the start. There is no (portable) mechanism >within a Fortran program to rename a file. If you don't or can't go this >way, what you need is a rename at the OS level - i.e., the "mv" command >under Unix/Linux or the "ren" command under Windows. > > Jan ... which can be done with a system call. Chris |
|
|||
|
In a previous article, =?ISO-8859-1?Q?Jan_Vorbr=FCggen?= <jvorbrueggen-not@mediasec.de> wrote:
>> ... which can be done with a system call. > >Sure - but that isn't portable, either. > > Jan I think the capability is portable these days. Unless you are writing commercial programs, portable capability is what's important. (but we do have to know what compiler before we can be specific about the call format) Chris |
|
|||
|
Alexander Slanina wrote:
> Hi folks ! > > End of my wits ![]() > > My fortran program produces 4 log-files. After these files are closed > i want them to have other filenames, like old_name + date + time + > ".log". Call this subroutine ('filename_date_time ') for your log-files (after log-files are closed): subroutine filename_date_time (NameFile, ierr) use dfwin, only: MoveFile implicit none character(*), intent(in):: NameFile !log file name - without '.log' integer, intent(out):: ierr character(8):: date character(10):: time call date_and_time(date, time) ierr= MoveFile(NameFile//'.log.'//char(0),NameFile//date//time//'.log'//char(0)) endsubroutine It will work under Windows. For Unix, you write own MoveFile wrapper function (use 'rename'). -- Aca. |
|
|||
|
<meek@skyway.usask.ca> wrote:
> In a previous article, =?ISO-8859-1?Q?Jan_Vorbr=FCggen?= <jvorbrueggen-not@mediasec.de> wrote: > >> ... which can be done with a system call. > >Sure - but that isn't portable, either. > I think the capability is portable these days. Unless you > are writing commercial programs, portable > capability is what's important. Portability of the capability is certainly the most basic thing, but it is far from the only one - commercial application or not. In particular, I think it highly important to document and isolate the use of practices that require changes when porting from one system to another. In order to document and isolate them, you first need to know what they are. Thus I think it important to point them out, as Jan did. That doesn't mean not to do it - just to make sure that you be aware of the dependency. For the case in question, I suspect that opening the file with the appropriate name is the better choice, as mentioned elsewhere. I can't tell for sure, though. -- Richard Maine | Good judgment comes from experience; email: my first.last at org.domain| experience comes from bad judgment. org: nasa, domain: gov | -- Mark Twain |
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Re: How to change .xls files into .txt files in SAS | Alan Churchill | Newsgroup comp.soft-sys.sas | 0 | 06-23-2006 08:20 PM |
| Re: How to change .xls files into .txt files in SAS | SUBSCRIBE SAS-L Chandra Gadde | Newsgroup comp.soft-sys.sas | 0 | 06-23-2006 07:18 PM |
| Re: How to change .xls files into .txt files in SAS | Terjeson, Mark | Newsgroup comp.soft-sys.sas | 0 | 06-23-2006 07:11 PM |
| Re: Processing multiple CSV files from a directory | David L. Cassell | Newsgroup comp.soft-sys.sas | 0 | 05-09-2005 10:56 PM |