View previous topic :: View next topic |
Author |
Message |
technophobe
Joined: 28 May 2007 Posts: 29
|
Posted: Wed Jun 27, 2007 3:11 pm Post subject: "call system" problems with file storage |
|
|
Hello folks,
I'm trying to write a program that will store data in various folders so that in my post-processing stages I can easily access the relevant data. I am using the windows xp operating system. I want my program to be portable so i thought I'd try to make use of the "call system" functions to change the current directory. Rather than specifying all the file locations manually I thought the call system commands might make life a bit easier.
As far as I'm aware, the place where the executable is stored (or compiled?) is the 'root' folder and a section of code:
Code: | OPEN(UNIT=10,FILE=myfile.dat)
READ(10,*) mydata
CLOSE(UNIT=10) |
will cause the program to look in the root folder for a file called "myfile.dat" and read the data stored therein.
I am trying to change the current directory so that rather than reading from the root folder it reads data from another folder - which I want to specify in the code. I want to give the location of the new folder in relation to the executable rather than giving the full pathname of each data file. I thought an easy (and portable) way to do this was to use the "call system" function:
Code: | call system('cd folder#2') |
for example. This was intended to change the current directory to 'folder#2' so that any data stored/read would default to this folder.
I can's seem to get this working and wondered if anyone could point out where I'm going wrong (or perhaps mention a better wat to solve this problem)? I don't want to prescribe all the file locations as I want to give my executable file to my colleagues and have it work on their computers without them having to edit the .f90 code or re-organise their hard-disks to that they have the same layout as mine.
I'd be very grateful for any advice,
Bren |
|
Back to top |
|
|
technophobe
Joined: 28 May 2007 Posts: 29
|
Posted: Wed Jun 27, 2007 4:35 pm Post subject: DOH! |
|
|
sorry guys - I figured this out and now realise I was being really stupid!
Thanks for reading anyway |
|
Back to top |
|
|
mogwins
Joined: 03 Nov 2007 Posts: 1
|
Posted: Fri May 02, 2008 6:21 pm Post subject: |
|
|
I too am stuck on this problem - any chance of sharing your solution?! |
|
Back to top |
|
|
|