- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am running a code in Digital Fortran where a .run file is specified under Program>Settings>Program Arguments. The code runs succesfully.
I am also currently trying to translate the code so that it can run in Visual Studio 2008. Is there a way to specify the same .run file as a program argument there? I tried to specify the file under Project>Properties>Configuration Properties>Debugging>Command Arguments but it doesn't seem to work.
Thank you.
Christina
I am also currently trying to translate the code so that it can run in Visual Studio 2008. Is there a way to specify the same .run file as a program argument there? I tried to specify the file under Project>Properties>Configuration Properties>Debugging>Command Arguments but it doesn't seem to work.
Thank you.
Christina
Link Copied
16 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, it works the same way as in VS98/CVF. I've done this many times.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Unfortunately it still does not seem to work. So when I specify the argument do I just write down the file name including the extention? Is there any symbol I need to include?
Thanks.
Christina
Thanks.
Christina
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Note you can havedifferent settings for command arguments, etc for debug and release.
Haveyou set the command arguments for both debug and release?
Haveyou set the command arguments for both debug and release?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for the note. I just did and still does not work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Can you attach a ZIP of a sample project showing the problem?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You need to have the file in the same folder as the project. or provide the complete path to the file.
Also, if you have release configuration and debug, you need to put it in the correct configuration -- plus, you would need to run from within the IDE. This hasn't changed from CVF, DVF, etc.
Also, if you have release configuration and debug, you need to put it in the correct configuration -- plus, you would need to run from within the IDE. This hasn't changed from CVF, DVF, etc.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I just tried this with this sample program:
When I run the program I get:
[plain] program cmdargs
implicit none
character(80) arg
integer i, num_args
num_args = COMMAND_ARGUMENT_COUNT()
print *, "There are", num_args, "arguments"
do i=1,num_args
call GET_COMMAND_ARGUMENT(i,arg)
print *, "Argument", i, "is ", trim(arg)
end do
end program cmdargs[/plain] In the project properties, Debugging, Command Arguments I have: First Second ThirdWhen I run the program I get:
[plain] There are 3 arguments Argument 1 is First Argument 2 is Second Argument 3 is Third[/plain]
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The line that gives the problem in the code is :
read(kcfile, '(a8)', end= 10) zcmndt
Variable "zcmndt" is supposed to read the data from the .run file (which I defined under the command arguments) -and it doesn't.
Do I need to make any further changes to this line except setting the file in the command arguments to make it work?
Thanks
Christina
read(kcfile, '(a8)', end= 10) zcmndt
Variable "zcmndt" is supposed to read the data from the .run file (which I defined under the command arguments) -and it doesn't.
Do I need to make any further changes to this line except setting the file in the command arguments to make it work?
Thanks
Christina
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ah, there were aspects you weren't telling us!
My guess is that you are relying on the Microsoft Fortran PowerStation feature where you can do:
OPEN (UNIT=kcfile, FILE='')
and it will open the file named in the first argument on the command line. You need an option to get that behavior - as you did in DVF/CVF. In Visual Studio, right click on the project and select Properties. Go to the Fortran > Compatibility property page and change "Files from command line (PowerStation)" to Yes, then rebuild.
If that doesn't solve the problem, please show us the statement where unit kcfile is opened.
My guess is that you are relying on the Microsoft Fortran PowerStation feature where you can do:
OPEN (UNIT=kcfile, FILE='')
and it will open the file named in the first argument on the command line. You need an option to get that behavior - as you did in DVF/CVF. In Visual Studio, right click on the project and select Properties. Go to the Fortran > Compatibility property page and change "Files from command line (PowerStation)" to Yes, then rebuild.
If that doesn't solve the problem, please show us the statement where unit kcfile is opened.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sorry for not being too clear but there are so many details..
Unfortunately that didn't solve the problem as well.
I believe this is the line you are looking for:
open(unit = kcfile, file = zcfile, status = 'UNKNOWN')
However, in the code the line menioned above exists in an "if statement" that is false and therefore is not read. kcfile is set equal to 5 in a previous if statement.
Does this make any sense?
Thanks!
Christina
Unfortunately that didn't solve the problem as well.
I believe this is the line you are looking for:
open(unit = kcfile, file = zcfile, status = 'UNKNOWN')
However, in the code the line menioned above exists in an "if statement" that is false and therefore is not read. kcfile is set equal to 5 in a previous if statement.
Does this make any sense?
Thanks!
Christina
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Were you using input redirection previously (did you have something like
in the command's "arguments")?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting Christina Syrrakou
Unfortunately it still does not seem to work. So when I specify the argument do I just write down the file name including the extention?
[SergeyK] What about a path to that file?
Is there any symbol I need to include?
Thanks.
Christina
[SergeyK] What about a path to that file?
Is there any symbol I need to include?
Thanks.
Christina
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Can you attach the actual program? Do you still have the DVF/CVF project and, if so, can you attach the .dsp file from that project? So far I am not seeing anything you have told us that would look at the command line.
Please also tell us what you have put in for the command arguments value. Ian had a good suggestion that you are using redirection. This has been broken in some earlier versions of Visual Studio - which Visual Studio version are you using?
Please also tell us what you have put in for the command arguments value. Ian had a good suggestion that you are using redirection. This has been broken in some earlier versions of Visual Studio - which Visual Studio version are you using?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting Steve Lionel (Intel)
Yes, it works the same way as in VS98/CVF. I've done this many times.
Hi Steve,
Why did you mention VS98 ( Visual Studio 98 )?
Just in case, I have a VS98 Enterprise Edition on one of my test laptops and I could verifyredirection,if
needed. Just let me know.
Best regards,
Sergey
PS:
It is 8:19pm inCalgary, AB and the current temparature outside is -32 Celsius. With a windchill it feels like -45 Celsius...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, you are right! I was using Now I am trying to run the code in Microsoft Visual Studio 2008 and it doesn't work.
Thank you..again!Learning a lot..
Christina
Thank you..again!Learning a lot..
Christina
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I mentioned VS98 because CVF used VS98 as the development environment.
I just tried an experiment with redirection in VS2008 and it worked. Make sure that your VTC_Mesh.run file is in the project folder (the one with the .vfproj file) and not with the executable. As an alternative, give the full path to the input file (enclose the file specification in "" if there are embedded spaces.)
There had been a bug in earlier VS versions through VS2005 where this did not work, but it does in VS2008.
What are the values of kcfile and zcfile? I am especially suspicious of your having FILE= in the OPEN because that would tend to block redirection. The redirection you are using assumes you are reading from "standard input" which is, by default, connected to unit 5. If you OPEN unit 5 to a separate file, then the redirection will not work.
I just tried an experiment with redirection in VS2008 and it worked. Make sure that your VTC_Mesh.run file is in the project folder (the one with the .vfproj file) and not with the executable. As an alternative, give the full path to the input file (enclose the file specification in "" if there are embedded spaces.)
There had been a bug in earlier VS versions through VS2005 where this did not work, but it does in VS2008.
What are the values of kcfile and zcfile? I am especially suspicious of your having FILE= in the OPEN because that would tend to block redirection. The redirection you are using assumes you are reading from "standard input" which is, by default, connected to unit 5. If you OPEN unit 5 to a separate file, then the redirection will not work.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page