Find the answer to your Linux question:
Results 1 to 3 of 3
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    Question Character for loop

    Sorry that the title is very vague, but I didn't know exactly how to title it. Either way, I am trying to make my own simple cryptography program, and I need to allow the user to assign numbers to each character (I'm trying to include all characters if possible). Is there a way that I could use a for loop to do this without having to go through each character one by one. By the way, I am programming this in C++.


  2. #2
    Linux Guru
    Join Date
    Dec 2013
    Victoria, B.C. Canada
    Presuming ascii it is quite simple. man ascii(7) will show you the conversion from decimal integer to ascii character. Loop through the range that interests you and cast the int to char.

  3. #3
    Thanks for the help! I know it was probably a stupid question to start with, but I really didn't want to write all the lines down. Thanks!

  4. $spacer_open

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts