|
forums.silverfrost.com Welcome to the Silverfrost forums
|
View previous topic :: View next topic |
Author |
Message |
davidb
Joined: 17 Jul 2009 Posts: 560 Location: UK
|
Posted: Thu Nov 03, 2016 9:17 am Post subject: Small issue with get_command_argument |
|
|
In the following code, status should be returned as -1 with the following command line, but 0 is returned.
anon.exe 123456789
Code: |
program anon
integer :: k, l
character(len=8) :: buffer
call get_command_argument(1, buffer, length=l, status=k)
print *, 'status = ', k,' Should be -1 but isn''t!'
print *, 'length = ', l,' Should be 9 and is!'
end program anon
|
The character array buffer contains the correct values (first 8 characters); it is just the status that is incorrect.
I can work around this by testing the length value, but probably this should be fixed. This may be a hang-over from the early days as this error also occurs in the F2KCLI code. Later compilers nagfor, ifort, gfortran don't have this issue. _________________ Programmer in: Fortran 77/95/2003/2008, C, C++ (& OpenMP), java, Python, Perl |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7916 Location: Salford, UK
|
Posted: Thu Nov 03, 2016 6:29 pm Post subject: |
|
|
Thanks for the feedback. The 64 bit version is OK. The 32 bit version needs to be fixed. |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7916 Location: Salford, UK
|
Posted: Fri Nov 04, 2016 11:13 am Post subject: |
|
|
This bug has now been fixed for the next release. There was also a different bug in 64 bit mode and this has also been fixed. |
|
Back to top |
|
|
davidb
Joined: 17 Jul 2009 Posts: 560 Location: UK
|
Posted: Fri Nov 04, 2016 12:25 pm Post subject: |
|
|
Paul,
Thanks very much for looking at this.
Could you also increase the internal size limit from 256 to 260 (just another 4 characters).
This will allow the maximum file path names to be read (The maximum path in windows is MAX_PATH - 1 where MAX_PATH=260. I have allowed an additional character above).
Also the length argument seems to be the limited by the size limit, but this may be harder to fix.
See this example:
Code: |
program example
integer :: l
! String 1 bigger than the size limit (currently 256)
character(len=257) :: arg
call get_command_argument(1, arg, length=l)
print *, arg
print *, 'length = ', l, ' should be 257 but isn''t'
end program example
|
which I run with a batch file like this:
Code: |
set path=1234567890 ... 123456X
CheckMate\Win32\anon.exe %path%
|
where ... is enough characters to create 257 character name _________________ Programmer in: Fortran 77/95/2003/2008, C, C++ (& OpenMP), java, Python, Perl |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7916 Location: Salford, UK
|
Posted: Fri Nov 04, 2016 2:42 pm Post subject: |
|
|
I have increased the buffer size to 260.
The other issue requires the unravelling of lots of old code.
It might be simpler for us to use the code for 64 bit mode if that is working OK. |
|
Back to top |
|
|
davidb
Joined: 17 Jul 2009 Posts: 560 Location: UK
|
Posted: Fri Nov 04, 2016 3:42 pm Post subject: |
|
|
Don't worry about the other issue.
If the limit has been increased to 260 I should be able to detect when more than 259 characters are entered, which is all I need.
Thanks again. _________________ Programmer in: Fortran 77/95/2003/2008, C, C++ (& OpenMP), java, Python, Perl |
|
Back to top |
|
|
|
|
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
|