Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9155801
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T12:39:29+00:00 2026-06-17T12:39:29+00:00

#include <string.h> #include <stdio.h> #include <windows.h> #include <wchar.h> #include <unistd.h> #define sleep(x) Sleep(1000 *

  • 0
#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;

} 

Hi! I don’t know what arguments I need to put when I recall main function, and I really can’t find the answer, I know it’s exist somewhere. 🙂 And here is the error what show me the MinGW compiler.

$ 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

Sorry for my bad english! Thank you!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T12:39:30+00:00Added an answer on June 17, 2026 at 12:39 pm

    Instead of calling main() after 1 second to create some sort of loop to wait for a specified amount of time, you can use an actual loop! Try something like this:

    checkTime(&getCheckTime);
    while(*getFirstArgument != getCheckTime) {
        sleep(1);
        checkTime(&getCheckTime);
    }
    
    // Do something after the provided time
    if(*getSecondArgument == 'r') {
        system("shutdown /r");
    } else {
        system("shutdown /s"); 
    }
    

    Furthermore, I do not really understand what you are planning to do. So the snippet above will not likely fix your complete program.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

#include<stdio.h> #include<zlib.h> #include<unistd.h> #include<string.h> int main(int argc, char *argv[]) { char *path=NULL; size_t size;
#include<stdio.h> #include<string.h> #include<stdlib.h> int main() { // int char str[40],ch; FILE*fp,*fp1,*fp2; fp=fopen(ide_input,w); fp1=fopen(error_log,w); fp2=fopen(lex_output,w);
#include <string.h> #include <stdlib.h> #include <stdio.h> int main(void) { unsigned char *stole; unsigned char
Here is my code: #include <stdio.h> #include <string.h> #include <windows.h> #include <tchar.h> #define MAX_KEY_LENGTH
#include<stdlib.h> #include<string.h> #include<stdio.h> int pstrcmp( char **p,char **q) { return strcmp(*p,*q) ; } int
#include<iostream> #include<stdlib.h> #include<string.h> #include<stdio.h> using namespace std; union type{ int a; char b; int
Please see this piece of code: #include<stdio.h> #include<string.h> #include<stdlib.h> int main() { int i
The following code outputs Illegal seek: #include <stdio.h> #include <errno.h> #include <string.h> int main()
The following C program: #include <stdio.h> int main(void) { printf("%u %u %u\n",sizeof "",sizeof(""+0),sizeof(char *));
#include<stdio.h> #include<stdlib.h> #include<ctype.h> #include<string.h> struct person *create_node(char *, char *,int); void addnode(char *,char *,int,struct

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.