LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 07-03-2015, 10:54 AM   #1
AlexBB
Member
 
Registered: Mar 2014
Posts: 464

Rep: Reputation: Disabled
Neither Gfortran's CHAR nor ACHAR work in Ubuntu 14.04


Hi there. I need this conversion: Integer==>character string. Nothing I tried so far worked for me. For instance in this calling sequence:

Code:
call printDebugThree (lun2,NN,Input,CHAR (jj)//" *** ",jj)
The fourth variable is defined in subroutine printDebugThree as:

Code:
printDebugThree (lun2,NN,Input,string,numb)
  implicit none
  DOUBLE COMPLEX, DIMENSION (:), intent (in), POINTER :: Input
  integer*4, intent (in) :: NN,lun2,numb
  integer*4 :: jj
  character (len = *), intent (in) :: string
  write (lun2,*) "# ", string, " ", numb
All I get from the string is an unprintable character in lieu of CHAR(jj), then "***" which comes out correctly.The unprintable character is a square with four symbols in it which I don't understand. Unfortunately I cannot reproduce it here, it does not come out in "Preview Post."

I need this conversion. Any help will be appreciated. Thanks. - Alex

P.S. It is interesting. I just went through my output file and found that not all printed characters are unprintable but it also prints characters (instead of this square) which are not a part of the coded output, e.g #,$,),(,*, etc. It is very strange.

Last edited by AlexBB; 07-03-2015 at 11:00 AM.
 
Old 07-03-2015, 11:32 AM   #2
AlexBB
Member
 
Registered: Mar 2014
Posts: 464

Original Poster
Rep: Reputation: Disabled
Actually I've solved the problem with this function. I changed it slightly and it works correctly.

Code:
character(len=20) function strConv(k)
!   "Convert an integer to string."
! http://stackoverflow.com/questions/1262695/converting-integers-to-strings-in-fortran
    integer, intent(in) :: k
    write (strConv, *) k
    strConv = adjustl(strConv)
end function strConv
But the problem in OP is still there. Those functions do not work. Thanks, -Alex
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] READ statement in GFortran does not work. AlexBB Programming 2 11-05-2014 07:18 PM
unable to install gfortran in ubuntu 10.04 Gunasekar11 Linux - Newbie 1 02-09-2013 11:59 AM
Problem getting Sed to work with special char inputs. shaselai Programming 8 10-23-2009 01:10 PM
Perl char frequency in a string doesn't work richikiki Programming 9 07-21-2006 04:50 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 03:14 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration