forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

"call system" problems with file storage

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support
View previous topic :: View next topic  
Author Message
technophobe



Joined: 28 May 2007
Posts: 29

PostPosted: Wed Jun 27, 2007 3:11 pm    Post subject: "call system" problems with file storage Reply with quote

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
View user's profile Send private message Send e-mail
technophobe



Joined: 28 May 2007
Posts: 29

PostPosted: Wed Jun 27, 2007 4:35 pm    Post subject: DOH! Reply with quote

sorry guys - I figured this out and now realise I was being really stupid!

Thanks for reading anyway Very Happy
Back to top
View user's profile Send private message Send e-mail
mogwins



Joined: 03 Nov 2007
Posts: 1

PostPosted: Fri May 02, 2008 6:21 pm    Post subject: Reply with quote

I too am stuck on this problem - any chance of sharing your solution?!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group