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

  • SEARCH
  • Home
  • 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 8900613
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T01:08:24+00:00 2026-06-15T01:08:24+00:00

i have a function that read config file and i wanted to reload this

  • 0

i have a function that read config file and i wanted to reload this function to get the new variables

void readConfigFile()
{
    ifstream File;
    File.open("config.txt", ios::in);
    while (!File.eof()){
        string line;
        int Hour;
        int Minuts;
        getline(File, line);
        File >> Hour >> Minuts;
    }
    File.close();
}

int main()
{
    readConfigFile();
    while (1) {
        time_t now;
        struct tm *current;
        now = time(0);
        current = localtime(&now);
        if( current->tm_hour == Hour && current->tm_min == Minuts){
            std::cout <<  "Done" << std::endl;
        }
        Sleep(5000);
    }

    return 0;
}

how i can reload this readConfigFile() function to get the new Hour / Minuts while application running

for example

if(Clicked Button){

reload readConfigFile();

}

while i searching on internet about reload

i found that i can do that with operators overloading

but i couldnt use it

i am still begainner 🙁

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-15T01:08:26+00:00Added an answer on June 15, 2026 at 1:08 am

    I’m guessing that the problem is that the variables Hour and Minuts (sic) are local to the readConfigFile function.

    That means that whenever you call readConfigFile you only change those local variables, not whatever global variabled you might have.

    If those variables were global, then you just have to call readConfigFile again, and it will read into them again.

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

Sidebar

Related Questions

I have a powershell script that needs to read from a config file with
I have a function that calls out a read or write request on a
In my Java code I have function that gets file from the client in
I have a function that searches for a string inside a text file. I
This is how to parse a config file question. Basically i have a text
I have a config file in which I have keys and values, like this:
I have added a config file (myapp.exe.config) that is deployed to the device after
I have read documentation for functions such as values and define-values that return and
Inside my Controller i have function that runs after user clicks on item, which
So I have function that formats a date to coerce to given enum DateType{CURRENT,

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.