Home > Archive > Fortran > May 2005 > question about "call qsort"
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
question about "call qsort"
|
|
|
| I found "call qsort" in Compaq visual fortran version.
I need to use but i don't know how.
Is there anybody that can help me?
thanks.
--
Elena Cannuccia. Rispondi via email.
| |
| glen herrmannsfeldt 2005-05-28, 3:58 pm |
| Elena wrote:
> I found "call qsort" in Compaq visual fortran version.
> I need to use but i don't know how.
> Is there anybody that can help me?
> thanks.
qsort() is a standard C library routine.
void
qsort(void *base, size_t nmemb, size_t size,
int (*compar)(const void *, const void *))
You are either calling that routine, or a routine to interface
between Fortran and C.
In C, the arguments are:
1) A pointer to the array to sort.
2) The number of elements in the array.
3) The number of bytes, as defined by C, in each element.
4) A pointer to a function that will compare two elements, when given
pointers to those two elements, and return a negative, zero, or
positive value indicating that the first is less than, equal, or
greater than the second.
Calling the C routine would require the second and third argument to
be called by value. Otherwise, they likely follow the Fortran calling
convention.
Posting the statement making the call and declarations for the arguments
would help.
-- glen
| |
|
| Elena wrote:
>
> I found "call qsort" in Compaq visual fortran version.
> I need to use but i don't know how.
CVF manual doesn't show it, but it could be in one of the "sample"
folders. Other than that, try
call qsort (n, array)
If compiler squawks about type mismatch reverse the arg sequence.
| |
| James Van Buskirk 2005-05-29, 3:59 am |
| "bv" <bvoh@Xsdynamix.com> wrote in message
news:4298C755.917E2D4@Xsdynamix.com...
> Elena wrote:
[color=darkred]
> CVF manual doesn't show it, but it could be in one of the "sample"
> folders. Other than that, try
> call qsort (n, array)
> If compiler squawks about type mismatch reverse the arg sequence.
Another possibility:
http://h21007.www2.hp.com/dspp/file...umm/rfqsort.htm
--
write(*,*) transfer((/17.392111325966148d0,6.5794487871554595D-85, &
6.0134700243160014d-154/),(/'x'/)); end
| |
| David Frank 2005-05-29, 3:57 pm |
|
"Elena" <17831invalid@mynewsgate.net> wrote in message
news:2005052810115017831@mynewsgate.net...
>I found "call qsort" in Compaq visual fortran version.
> I need to use but i don't know how.
> Is there anybody that can help me?
> thanks.
>
CALL SORTQQ is documented
| |
| Herman D. Knoble 2005-05-31, 4:01 pm |
| There are sources of Fortran source for Qsort; you might consider
adding one of these to your code instead of depending on a library
routine. For example: http://www.fortran-2000.com/
Skip
On Sat, 28 May 2005 10:11:50 GMT, "Elena" <17831invalid@mynewsgate.net> wrote:
-|I found "call qsort" in Compaq visual fortran version.
-|I need to use but i don't know how.
-|Is there anybody that can help me?
-|thanks.
|
|
|
|
|