Jump to content

Check out our Community Blogs

Register and join over 40,000 other developers!

Recent Status Updates

View All Updates

- - - - -

Is alnum ASCII only?


  • Please log in to reply
1 reply to this topic

#1 kenna


    CC Regular

  • Just Joined
  • PipPipPip
  • 32 posts

Posted 22 November 2007 - 11:07 AM

Is isalnum ASCII only (locale independent) or does is return true for any character of any locale?

I'm trying to write a short program that converts a binary file into an escaped string that can be included in a source file, thus I need to escape everything not /{0~9a~zA~Z}/.

e.g. static char image = "[converted data goes here]";

Also, is char always 8 bits, or are there platforms where it changes? and is there a simple way of implementing portable data type sizes (not only char).
  • 0

#2 WingedPanther73


    A spammer's worst nightmare

  • Moderator
  • 17757 posts
  • Location:Upstate, South Carolina
  • Programming Language:C, C++, PL/SQL, Delphi/Object Pascal, Pascal, Transact-SQL, Others
  • Learning:Java, C#, PHP, JavaScript, Lisp, Fortran, Haskell, Others

Posted 23 November 2007 - 08:05 AM

Depending on your environment, you may not be dealing with ASCII at all. C/C++ works just as well with EBCDIC and other character encodings. You would need to check with your compiler documentation to see if there is any locale information involved.

Similarly, the number of bits a char can store is implementation dependent, depending on your hardware architecture, OS, and compiler.
  • 0

Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

My MineCraft server site: http://banishedwings.enjin.com/

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download