I am a fresh in programming, I wanna to call a fortran function in my c++ code. the thing is I dont know how to pass a fortran character*81 array to my c++.
fortran code is like:
subroutine func01(a)
implicit none
character*81 a(2)
write(*,*) a(1)
write(*,*) a(2)
end
c++ code is like:
#include <iostream>
extern "C"{
void func01_( const char **a );
}
int main()
{
const char *a[2];
a[0]="Hello world!";
a[1]="This is a test!";
func01_(a);
return 0;
}
I bascially tested my fortran code using this
program pro01
character*81 a(2)
a(1)='Hello world!'
a(2)='This is a test!'
call func01(a)
end program pro01
'func01(a)' works well.
thanks to @PaulMcKenzie, I corrected some fool problems.....
However, when i compiled cpp code, the result went like messy codes like:
7
@L
@��n��@�UH�j��FP
@��n���U�շ�=��U�ྼ��� @��
what should I do?