Results 1 to 6 of 6

Thread: Implementation of iscntrl() in C language

  1. #1
    Join Date
    Dec 2009
    Posts
    23

    Implementation of iscntrl() in C language

    Hi, I am working in the xyz company as software tester. I have the knowledge of the functions of C language. But I can not know anything about the iscntrl() function of C language. So, I would like to know about the iscntrl() function. I also would like to know how can I implement the iscntrl() function in the program. So, Can anyone help me to know about the iscntrl() function.
    Last edited by Servant; 10-02-2010 at 08:07 PM.

  2. #2
    Join Date
    May 2008
    Posts
    2,389

    re: Implementation of iscntrl() in C language

    Any control characters can be checked by using the iscntrl() function in the C language. The value of the particular character can be from the 0 to 31 can called the control character. The iscntrl() function can returns the zero if the value of the argument can not be the control character. The iscntrl() function can returns the non-zero if the value of the argument can be the control character.

  3. #3
    Join Date
    Feb 2008
    Posts
    1,852

    The iscntrl() in C language

    These code of lines can guide you that how the iscntrl() function can works :
    Code:
    #include <stdio.h>
    #include <ctype.h>
    char ch[] = {'A', 0x09, 'Z'};
    #define SIZE sizeof( ch ) / sizeof( char )
    void main()
      {
        int a;
        for( a = 0; a < SIZE; a++ ) 
    {
          printf( "Char %c is %sa Control character\n",
            chars[a],
            ( iscntrl( ch[a] ) ) ? "" : "not " );
        }
      }
    Output of the above code as :
    Code:
    Char A is not a Control character
    Char     is a Control character
    Char Z is not a Control character

  4. #4
    Join Date
    Jan 2008
    Posts
    1,521

    Implemntation of iscntrl()

    Example :
    Code:
    #include <stdio.h>
    #include <ctype.h>
    int main ()
    {
      int j=0;
      char sr[]="first line \n second line \n";
      while (!iscntrl(sr[j]))
      {
        putchar (sr[j]);
        j++;
      }
      return 0;
    }
    The above code of lines can prints until a control character that can breaks the while loop can arise, string character by character.

  5. #5
    Join Date
    Apr 2008
    Posts
    1,948

    re: Implementation of iscntrl() in C language

    The Program states the behavior of the iscntrl() function as follows :
    Code:
    #include <stdio.h>
    int main() 
    {
      if( iscntrl( 'a' ) )
      {
         printf( "Character a is not control character\n" );
      }
      if( iscntrl( '\n' ) )
      {
         printf( "Character \n is control chracter\n" );
      }
      return 0;
    }
    The above program produce the following output :
    Code:
    Character \n is control chracter

  6. #6
    Join Date
    May 2008
    Posts
    2,012

    iscntrl()

    The iscntrl() function can returns the non-zero if the argument of the iscntrl() function can be the any of the following :
    Code:
    BEL BS CR FF HT NL VT
    The following can be the syntax of the iscntrl() function :
    Code:
    #include <stdio.h>
    int iscntrl(int s);

Similar Threads

  1. Replies: 8
    Last Post: 19-04-2012, 08:12 PM
  2. Replies: 3
    Last Post: 31-01-2011, 11:57 PM
  3. Replies: 7
    Last Post: 08-12-2010, 02:20 AM
  4. Implementation of mkfifo() : C
    By Garett in forum Software Development
    Replies: 4
    Last Post: 02-02-2010, 07:27 PM
  5. Vista ultimate Language Pack for Greek language
    By ph_oratis in forum Windows Update
    Replies: 3
    Last Post: 29-11-2009, 03:15 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,557,378.13714 seconds with 16 queries