What does this mean?
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: What does this mean?

  1. #1
    Join Date
    Nov 2012
    Posts
    8

    What does this mean?

    cprintf(%c,196);

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Wallisellen (ZH), Switzerland
    Posts
    17,604

    Re: What does this mean?

    Quote Originally Posted by aditya.manglik View Post
    cprintf(%c,196);
    It means, that someone who wrote this line avoids to read the documentation.
    Please, read MSDN:
    http://msdn.microsoft.com/en-us/libr...71(VS.80).aspx
    http://msdn.microsoft.com/en-us/libr...dt(VS.80).aspx

    PS. If you are using some other compiler (non-Microsoft) - then tell us which one.
    Victor Nijegorodov

  3. #3
    Join Date
    Dec 2012
    Location
    England
    Posts
    2,842

    Re: What does this mean?

    As stated, this is an invalid statement. I presume you mean

    Code:
    cprintf("%c", 196);
    This is a Posix function that formats and outputs to the console. With Microsoft Visual Studio since the 2005 release this is a depreciated function and _cprintf(..) should be used.

    In your case this will output the ASCII character coresponding to the decimal equivalent of 196 to the console. The affect of this may vary depending upon which OS you are using (which you don't state). On a Microsoft OS from a console it will display a horizontal line of one character width.

  4. #4
    Join Date
    Dec 2012
    Location
    England
    Posts
    2,842

    Re: What does this mean?

    Re my previous post. I hate 'magic numbers' in code. You might find below of use to make the code more readable (for Microsoft console).


    Code:
    #define CON_SL_TL	218			//Single top left
    #define CON_SL_TR	191			//Single top right
    #define CON_SL_BL	192			//Single bottom left
    #define CON_SL_BR	217			//Single bottom right
    #define CON_SL_VERT	179			//Single vertical
    #define CON_SL_HOR	196			//Single horizontal
    #define CON_SL_LT	195			//Single left tee
    #define CON_SL_RT	180			//Single right tee
    #define CON_SL_TT	194			//Single top tee
    #define CON_SL_BT	193			//Single bottom tee
    #define CON_SL_X	197			//Single cross

Posting Permissions

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


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center