#include <string.h>
#include <stdio.h>
#include <windows.h>
#include <wchar.h>
#include <unistd.h>
#define sleep(x) Sleep(1000 * x)
int checkTime();
int main ( int argc, char *argv[] ) {
char *getFirstArgument = argv[1];
char *getSecondArgument = argv[2];
char getCheckTime;
checkTime(&getCheckTime);
if(*getFirstArgument != getCheckTime) {
sleep(1);
main(*getFirstArgument);
} else if(*getFirstArgument == getCheckTime && *getSecondArgument == 'r') {
system("shutdown /r");
} else if(*getFirstArgument == getCheckTime) {
system("shutdown /s");
}
return 0;
}
int checkTime() {
char getConvertedTime[5] = {};
SYSTEMTIME localTime;
GetLocalTime ( &localTime );
sprintf( getConvertedTime, "%d:%d", localTime.wHour, localTime.wMinute );
printf( "%s\n", getConvertedTime );
return 0;
}
やあ!メイン関数を思い出すときにどの引数を指定する必要があるのか わかりません。答えが本当に見つかりません。それがどこかに存在することはわかっています。:) そして、これが MinGW コンパイラを示すエラーです。
$ gcc -Wall test.c -o test.exe
test.c: in function 'main':
test.c:20:3: error: to few arguments to function 'main'
test.c:10:5: note: declared here
私の悪い英語でごめんなさい!ありがとうございました!