Using stdin instead of cin in the shell

Issue #93 resolved
Samir Menon repo owner created an issue

cin seems to be thread unsafe and doesn't work very well on some computers.

Consider using stdin instead. Eg.

CRobotApp.cpp

    char a[1024];
    /** Might prevent a "command not found" print on some computers */
    fscanf(stdin,"%*[^\n]%*c", a);

    while(scl::CDatabase::getData()->running_)
    {
      while(scl::CDatabase::getData()->running_ &&
          mode_char == false)
      {
        std::cout<<"\nscl>> ";
        fgets(a, 1024, stdin);
        a[strlen(a)-1] = '\0';

        //Split the string into string tokens
        std::istringstream iss(a);

Comments (2)

  1. Samir Menon reporter

    On the same computer, ncurses seems to exit improperly. Doesn't return to the shell. However exit works.

  2. Log in to comment