/[marvin]/marvin/src/gui/misc.cc
ViewVC logotype

Diff of /marvin/src/gui/misc.cc

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2 by castor_fou, Thu Sep 11 16:25:31 2003 UTC revision 1.3 by castor_fou, Tue Sep 16 20:25:36 2003 UTC
# Line 32  Line 32 
32  *******************************************************************/  *******************************************************************/
33  #include <string>  #include <string>
34  #include <iostream>  #include <iostream>
35    #include <stdio.h>
36    
37  #include "misc.hh"  #include "misc.hh"
38    #include "language/language.hh"
39    
40  std::string get_stdin()  std::string get_stdin(std::string default_choice)
41  {  {
42    std::string answer;    std::string answer;
43      std::string c;
44    std::cin >> answer;    
45    return answer;    c = getc(stdin);
46      if ((c == "\n") && (default_choice != ""))
47        {
48          fflush(stdin);
49          return default_choice;
50        }
51      else
52        if ((c == "\n") && (default_choice == ""))
53          {
54            fflush(stdin);
55            return "";
56            
57          }
58        else
59          {
60            int it = 0;
61            do
62              {
63                answer.insert(it, c);
64                c = getc(stdin);
65                it++;
66              }
67            while (c  != "\n");
68            fflush(stdin);
69            return answer;
70          }
71  }  }
72    
73  int max(int a, int b)  int max(int a, int b)
# Line 49  int max(int a, int b) Line 76  int max(int a, int b)
76      return a;      return a;
77    return b;    return b;
78  }  }
79    
80    int check_path(std::string path)
81    {
82      FILE *file;
83    
84      if ((file = fopen(path.c_str(), "r")) == NULL)
85        {
86          std::cerr << ERROR6 << std::endl;
87          return 1;
88        }
89      return 0;
90    }

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26