print the values of the predefined symbolic constants

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • AnagJohari
    New Member
    • May 2010
    • 96

    print the values of the predefined symbolic constants

    I m not able to understand how i print the values of predefined symbolic constant.
    i have to print the values of
    _lINE_ The line number of the current source code line (an integer constant)
    _FILE_ The presumed name of the source file (a string)
    _DATE_ The date the source file is compiled (a string of the form “Mmm dd yyy” such
    as Jan 19 2002)
    _TIME_The time the source file is compiled (a string literal of the form “hh:mm:ss”)

    i m not able to understand how i print the values of these predifined symbolic constant

    please help ,me guyssssss
  • whodgson
    Contributor
    • Jan 2007
    • 542

    #2
    Originally posted by AnagJohari
    I m not able to understand how i print the values of predefined symbolic constant.
    i have to print the values of
    _lINE_ The line number of the current source code line (an integer constant)
    _FILE_ The presumed name of the source file (a string)
    _DATE_ The date the source file is compiled (a string of the form “Mmm dd yyy” such
    as Jan 19 2002)
    _TIME_The time the source file is compiled (a string literal of the form “hh:mm:ss”)

    i m not able to understand how i print the values of these predifined symbolic constant

    please help ,me guyssssss
    Just use say printf() and specify the name of the predefined macro say _TIME_.If _TIME_ has a value of
    "11:10:09" it will print 11:10:09.

    Comment

    • donbock
      Recognized Expert Top Contributor
      • Mar 2008
      • 2427

      #3
      What have you tried?

      Comment

      • AnagJohari
        New Member
        • May 2010
        • 96

        #4
        Originally posted by whodgson
        Just use say printf() and specify the name of the predefined macro say _TIME_.If _TIME_ has a value of
        "11:10:09" it will print 11:10:09.
        Not working
        i try
        Code:
        #include<conio.h>
        #include<stdio.h>
        #define _TIME--->its not working whether i use this statement or not
        void main()
        {
        printf("%d",_TIME_);
        getch();
        }
        i also use this printf(_TIME_);
        but not working.
        can write the code please

        Comment

        • donbock
          Recognized Expert Top Contributor
          • Mar 2008
          • 2427

          #5
          You must remove line 3. You definitely do not want to define any of these built-in macros yourself, let the compiler take care of defining them for you.

          Part of your problem is that you are misspelling the predefined macros. They begin and end with two underscore characters.

          Another problem is using "%d" format string for __TIME__. This format string is for a number, but the macro expands to a quoted string.

          Comment

          Working...