String returned from C# to Fortran - problem

onkelhotte
Total Points:
2,900
Status Points:
2,400
Brown Belt
November 24, 2008 11:45 PM PST
Rate
 
#1
In C# I use StringBuilder to exchange strings with Fortran.
Here are two examples to get and put a character*4 value:
C#
	public static void putusername(string value)
	{
		StringBuilder stringBuilderValue = new StringBuilder(value.Substring(0, System.Math.Min(value.Length, 4)));
		PUT_USERNAME(stringBuilderValue, 4);
	}

	public static string getusername()
	{
		StringBuilder stringBuilderValue = new StringBuilder(4);
		GET_USERNAME(stringBuilderValue, 4);
		return stringBuilderValue.ToString();
	}


Fortran:
	subroutine put_dateiname(value)
		use globaleVariablen
		implicit none
		character*255 dateiname
		dateiname = value
	end subroutine put_dateiname
!
	subroutine put_username(value)
		use globaleVariablen
		implicit none
		character*4 username
		username = value
	end subroutine put_username


Intel Software Network Forums Statistics

8479 users have contributed to 31611 threads and 100667 posts to date.
In the past 24 hours, we have 31 new thread(s) 108 new posts(s), and 167 new user(s).

In the past 3 days, the most popular thread for everyone has been gemm(A,A,A) like possible? The most posts were made to gemm(A,A,A) like possible? The post with the most views is Dear Steve, excuse me for a d

Please welcome our newest member zhpn