C++ isprint and iscntrl

Discussion in 'Webmastering & Programming' started by JC724, Feb 14, 2018.

  1. JC724

    JC724 [H]Lite

    Messages:
    74
    Joined:
    Jan 20, 2016
    I really don't understand how isprint and iscntrl works?

    I was reading up online and it still didn't make a lot of sense to me?

    Can someone break down how both of those functions work?
     
  2. modi123

    modi123 [H]ardness Supreme

    Messages:
    4,795
    Joined:
    Sep 6, 2006
    What's to not understand?

    IsPrint - takes in a character and returns 0 if not printable, and any other number if true.
    http://www.cplusplus.com/reference/cctype/isprint/

    iscntrl is the same input/oputput but this time checks if control character.
    http://www.cplusplus.com/reference/cctype/iscntrl/

    Remember - there are ascii characters that can be printed to the screen and others that are not. Both of those links show the hexcode it checks if the characater between, and you cna follow along with an ascii table.

    example: http://www.bluesock.org/~willg/dev/ascii.html
     
    Armenius likes this.
  3. ChristianVirtual

    ChristianVirtual [H]ard DCOTM Mar 2016,Aug 2017

    Messages:
    2,375
    Joined:
    Feb 23, 2013
    for testing modi123 comment: try to print asc(0x7)