|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
Fortran to C
I am new to both FOrtran and C language. I need help in converting the following line of code from Fortran to C.
============================================== Do READ(handle, rec=I) tempstr If (tempstr(1:10) == "END_HEADER") EXIT upperstring = to_upper(tempstr(1:name_len)) IF (upperstring(1:name_len) == UpperName(1:name_len)) THEN !Svalue_temp(1: 44) = tempstr(37:80) Svalue_temp(1: bytes_left_1st_ln) = tempstr(value_1st_pos:REC_LEN) ! For attributes take more than one 80-bytes record low_end = bytes_left_1st_ln + 1 ! 45 up_end = low_end + REC_LEN -1 DO i = I +1 READ(handle, rec=I) tempstr1 ! hit another attribute IF ((tempstr1(eq_pos : eq_pos) == "=") .or. & (tempstr1(1:10) == "END_HEADER")) THEN EXIT END IF !! Svalue (low_end : up_end) = tempstr1(1:REC_LEN) Svalue_temp (low_end : up_end) = tempstr1(1:REC_LEN) low_end = up_end +1 up_end = low_end + REC_LEN -1 END DO found = 1 EXIT END IF I = I +1 END DO ============================================ Thanks Naseer |
|
#2
|
||||
|
||||
|
Is it coincidence that two different members are posting questions asking fortran to be converted to C?
None of this code is very complex or long, it would not take much time to learn enough of either language to translate this code. If you are new to both, why do you need to do this at all? |
|
#4
|
|||
|
|||
|
fortran to C
I have done C++. It is a new project and I took it as challenge. I have converted about 5000 lines. but this is something came new in the code.
Naseer |
|
#5
|
||||
|
||||
|
Hard to believe that if you've converted 5000 lines, you can't convert that. Where's your "challenge" if we do it for you? Besides, you're looking at variables and such that you aren't showing us.
__________________
C/C++ pointers (Original in the "Commonly Asked Questions" thread). |
|
#6
|
||||
|
||||
|
Quote:
Which line are you referring to as "the following line of code"? There are about 30 lines there. Which one is it? Also, what's the formatting? By not using code tags, you lost all indentation. My experience was with FORTRAN IV, in which specific columns had specific meaning. All that is lost in your post. |
|
#7
|
|||
|
|||
|
Fortran to C
I apologize for the mistyping. I have converted 500 lines.
|
|
#8
|
|||
|
|||
|
Fortran to C
Do
READ(handle, rec=I) tempstr If (tempstr(1:10) == "END_HEADER") EXIT ......... |
|
#9
|
||||
|
||||
|
So you're new to Fortran and you're new to C (what is your language?) and your boss has brought around some legacy code and asked for a volunteer to translate it.
Your boss should probably start a thread in the "Hire a Programmer" forum. |
|
#10
|
|||
|
|||
|
If you cannot answer the question, then please avoid asking irrevalent questions. ou need to go to "manners forum"
|
| Viewing: Dev Shed Forums > Programming Languages > C Programming > Fortran to C |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|