c++ - Updating a variable from a file in loop -


  • sorry grammar\spelling. i'm romanian.
  • i using code::blocks edit in c++ , notepad edit in batch.

i can't find better title this.

i'm trying use program:

#include <iostream> #include <fstream> #include "windows.h" #include <string> #include "g:\other.h" using namespace std; char message[500],from[20]; int interm; int main() {     ofstream wait1("errorlevel.f"); wait1<<0; wait1.close();     fstream wait2("errorlevel.f",ios::in); wait2>>interm;     cout<<"another window waiting you...";     system("start options_load-new.bat");     while (interm==0) { wait2>>interm; sleep(10); }     st();     //and program continues... } 

where st(); function declared in other.h as

void st() {     system("cls"); } 

and options_load-new.bat file this:

@echo off echo want do? echo [l] load pre-made message echo [n] make new 1 choice /c ln echo %errorlevel% > errorlevel.f exit 

but -

when run program, opens, starts .bat file, file sets errorlevel.f 1 or 2, , closes. after that, main program remains another windws waiting you... without action.

what should make main program continue operations?


Comments

Popular posts from this blog

Fail to load namespace Spring Security http://www.springframework.org/security/tags -

sql - MySQL query optimization using coalesce -

unity3d - Unity local avoidance in user created world -