Geekpedia Tutorials Home

Building a C# Chat Client and Server

Building a C# Chat Client and ServerA step by step tutorial teaching you how to create your own chat client and chat server easily in C#, for local networks or the Internet.

in C# Programming Tutorials

Getting Hard Drive Information

Getting Hard Drive InformationA C# tutorial showing you how to make use of WMI to extract information on disk drives, such as model, capacity, sectors and serial number.

in C# Programming Tutorials

UPS Shipping Calculator

UPS Shipping CalculatorThis tutorial will teach you how to calculate the shipping cost based on the weight, height, length and depth of the box, the distance and the UPS service type.

in PHP Programming Tutorials

Create Your Own Rich Text Editor

Create Your Own Rich Text EditorCreating a Rich Text Editor using JavaScript is easier to do than you might think, thanks to the support of modern browsers; this tutorial will walk you through it.

in JavaScript Programming Tutorials
Search
Tutorials
Programming Tutorials
IT Jobs
From CareerBuilder

C's predefined macros

A list of C's predefined macros (__FILE__, __LINE__, __STDC__...) with description and an example of how to use them.

On Sunday, March 21st 2004 at 10:43 AM
By Andrew Pociu (View Profile)
***--   (Rated 3.1 with 11 votes)
Contextual Ads
More C Resources
Advertisement

__FILE__ - a string that holds the path/name of the compiled file;
__LINE__ - an integer that holds the number of the current line number;
__DATE__ - a string that holds the current system date;
__TIME__ - a string that holds the current system time;
__STDC__ - defined as the value '1' if the compiler conforms with the ANSI C standard;
__cplusplus - determines if your compiler is in C or C++ mode. Usually used in headers.



#include <stdio.h>

void main(void)
{
    printf("The path/name of this file is %s\n", __FILE__);
    printf("The current line is %d\n", __LINE__);
    printf("The current system date is %s\n", __DATE__);
    printf("The current system time is %s\n", __TIME__);
    #ifdef __STDC__
        printf("The compiler conforms with the ANSI C standard\n");
    #else
        printf("The compiler doesn't conform with the ANSI C standard\n");
    #endif
    #ifdef __cplusplus
        printf("The compiler is working with C++\n");
    #else
        printf("The compiler is working with C\n");
    #endif
}
Digg Digg It!     Del.icio.us Del.icio.us     Reddit Reddit     StumbleUpon StumbleIt     Newsvine Newsvine     Furl Furl     BlinkList BlinkList

Rate Rate this tutorial
Comment Current Comments
by Platone on Thursday, October 14th 2004 at 11:10 AM

It is not the current system time / date, but the BUILDING time / date!!!
It works, but it's not what is printed!
Bye

by antred on Tuesday, February 14th 2006 at 11:03 AM

Of course it is, and I doubt the author was implying anything else.

by nazareth on Tuesday, October 10th 2006 at 06:09 PM

want to know about C will be great if ull forward me some Literature on it thanking u see u


Comment Comment on this tutorial
Name: Email:
Message:
Comment Related Tutorials
There are no related tutorials.

Comment Related Source Code
There is no related source code.

Jobs C Job Search
My skills include:
Enter a City:

Select a State:


Advanced Search >>
Sponsors
Discover Geekpedia

Other Resources