well i use bootime function to get and store time in my bios
but i want to enter time in my system . what should i use for time and what to do for date
well i am using time.h header files for that

also i need to know about pragma startup and endup directive

is it compulsary to write main fun in c and c++,can we only write 1 main fun.
plz give ur ans. with reasons

Recommended Answers

All 2 Replies

pragma startup

As for the times, it will depend on the operating system.

is it compulsary to write main fun in c and c++,can we only write 1 main fun.

Well the main function is the entry point for the executable. Just a special function that the compiler knows should be the sort-of first implicit call to start the program. So if you are not making an executable, like making a DLL or library or something like that, then a main function is not necessary and probably will do more harm then good. If you have more than one main function, how is the compiler supposed to know which one is the "program function", which one to start at the start of the executable? So an executable requires one and only one main function, anywhere in the code (one exception: Win32 programs start with WinMain(), but still the same rule apply to winmain as for main). I'm not entirely sure, but I think that if you try to execute an executable with no main() function in the console, it will say "this program cannot be executed in console mode." and vice versa for winmain.

well i use bootime function to get and store time in my bios but i want to enter time in my system . what should i use for time and what to do for date well i am using time.h header files for that

I'm not sure I understand the goal, but you probably want to take a look at Boost::Date_Time library. This is cross-platform and has all features that are supported by all systems (not sure you can reset the local_time, but maybe).

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.