replica nfl jerseysreplica nfl jerseyssoccer jerseyreplica nfl jerseys forums.silverfrost.com :: View topic - Reading 'extended' characters (XP vs. Win 7)
forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Reading 'extended' characters (XP vs. Win 7)

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support
View previous topic :: View next topic  
Author Message
BILLDOWS



Joined: 22 Jul 2005
Posts: 86
Location: Swansea, UK

PostPosted: Tue Oct 26, 2010 5:01 pm    Post subject: Reading 'extended' characters (XP vs. Win 7) Reply with quote

I have a program running under Vista or Windows 7 (32 bit) that reads single characters from a data file for subsequent display. One of the characters read in (a1) is a 'simple' vertical arrow and this works fine. [I know that some other such characters do not read correctly from file and one needs to use achar() to create them within the program].

However the same program running under XP will not read this character correctly and will not write out to screen such symbols created using achar().

Does anyone know if this is a function of the OS / the fonts installed or otherwise? I have tried compiling and running on XP but this has no effect.

Many Thanks for any ideas..

Bill
Back to top
View user's profile Send private message Visit poster's website
JohnCampbell



Joined: 16 Feb 2006
Posts: 2615
Location: Sydney

PostPosted: Wed Oct 27, 2010 1:36 am    Post subject: Reply with quote

Bill,

I'm not sure about the difference between achar and char for unusual characters. You could try the following program on both systems and see if there are any differences in either the file or the reading of the file. (The file may have changed when transferred ?)
Code:
      CHARACTER file_name*128, CMNAM*128, c
      INTEGER*4 ic, iostat, count(0:256), n, nc, na, nz
      EXTERNAL CMNAM
!
!  Open the text file as transparent
!
      file_name = CMNAM ()
      open (unit  =11,               &
            file  =file_name,        &
            status='OLD',            &
            form  ='UNFORMATTED',    &
            access='TRANSPARENT',    &
            iostat=iostat)
      write (*,*) 'Opening file ',trim(file_name),' iostat =',iostat
!
!  Read all characters
!
      count = 0
      n     = 0
      nc    = 0
      na    = 0
      nz    = 0
!
      do
         read (unit=11, iostat=iostat) c
         if (iostat /= 0) exit
!
         n  = n+1
         ic = ichar(c)
         count(ic) = count(ic)+1
         select case (ic)
            case (0:31)
               nc = nc + 1   ! control characters
            case (32:126)
               na = na + 1   ! normal character
            case (127:256)
               nz = nz + 1   ! other character
            case default
               write (*,*) 'Unrecognised character : ichar =',ic
         end select
      end do
!
      if (iostat == -1) then
         write (*,*) n,' characters read from file ',trim(file_name)
      else
         write (*,*) 'end of file after',n,' characters : IOSTAT =',iostat
      end if
      write (*,*) nc, ' control characters'
      write (*,*) na, ' normal characters'
      write (*,*) nz, ' non-printable characters'
      write (*,2001)
2001  format (/'Count of active characters'/ ' char   Count')
2002  format (i5,i8)
      do ic = 0,256
         if (count(ic) < 1) cycle
         if (ic >= 32 .and. ic <= 126) cycle
         write (*,2002) ic, count(ic)
      end do
      end
Back to top
View user's profile Send private message
BILLDOWS



Joined: 22 Jul 2005
Posts: 86
Location: Swansea, UK

PostPosted: Thu Oct 28, 2010 5:18 pm    Post subject: Extended Characters Reply with quote

Many thanks for this - your program does report that characters such as decimal 24 (up arrow when output on Windows 7 / Vista to screen or printer) are of course control characters. (I wanted to denote vertical using non-graphics characters and this worked fine on these OS.)

I can obviously use (slightly less effectively) standard printable characters for this and other purposes but was somewhat surprised the screen / printer output of several such characters differed in OS.

Thanks again

Bill
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group