I've copies and pasted code from all over the place for the simple task of getting the system date and time, but not a single piece of code actually does what it's supposed to.
Code:
caibbor@helios ~ $ cat one.cpp
#include <time.h>
void main() {
char sdate[9];
char stime[9];
_strdate( sdate );
_strtime( stime );
}
caibbor@helios ~ $ g++ one.cpp
one.cpp:4:11: error: '::main' must return 'int'
one.cpp: In function 'int main()':
one.cpp:7:17: error: '_strdate' was not declared in this scope
one.cpp:8:17: error: '_strtime' was not declared in this scope
caibbor@helios ~ $ cat two.cpp
//Date
#include <iostream>
#include <ctime>
int main ()
{
char date [10];
_strdate(date);
std::cout<<"Current Date:"<<date;
return 0;
}
caibbor@helios ~ $ g++ two.cpp
two.cpp: In function 'int main()':
two.cpp:8:16: error: '_strdate' was not declared in this scope
caibbor@helios ~ $ cat three.cpp
//Time
#include <iostream>
#include <ctime>
int main ()
{
char time [10];
_strtime(time);
std::cout<<"Current Time:"<<time;
return 0;
}
caibbor@helios ~ $ g++ three.cpp
three.cpp: In function 'int main()':
three.cpp:8:16: error: '_strtime' was not declared in this scope
caibbor@helios ~ $