#include %26lt;iostream%26gt;
#include %26lt;fstream%26gt;
using namespace std;
#define TRUE 1
#define FALSE 0
class file_line
{
 private:
  string one_line;
  ifstream to_read;
 public:
  file_line (char aFile[]) { to_read.open (aFile); }
  bool get_line (void);
  void close_file (void) { to_read.close(); }
  void put_line (void) { cout %26lt;%26lt; one_line %26lt;%26lt; endl; }
};
bool file_line::get_line (void)
{
 int to_temp [10], count_string = 0;
 bool been_through = FALSE;
 short count = 0;
 char numb_to [8];
 bool again = FALSE;
 string::iterator StrVal;
 if (!to_read.eof())
 {
  do
  {
   if (!been_through)
   {
    getline (to_read, one_line);
    StrVal = one_line.begin();
   }
   while (!(*StrVal %26gt;= '0' %26amp;%26amp; *StrVal %26lt;= '9') %26amp;%26amp; StrVal %26lt; one_line.end())
    StrVal+=1;
   while ((*(StrVal) != ' ' %26amp;%26amp; StrVal %26lt; one_line.end()) %26amp;%26amp; count %26lt; 8)
   {
    numb_to[count] = *StrVal;
    count++; StrVal++;
   }
   to_temp[count_string] = atoi (numb_to);
   count_string++;
   count = 0;
   again = TRUE;
  } while (StrVal %26lt; one
C++ help, needed by 5PM PST please! No room, but in file (VERTEX 500 600 700) ect... reads 500 500 uninitilize
From what I can tell, the problem, is here, the code doesn't look all that logical to me, but this is definately a problem:
to_temp[count_string] = atoi (numb_to); //numb_to is an array,
You're probably looking for something like this
to_temp[count_string] = atoi (numb_to[i]);
Then do this:
char *cp=numb_to[];
string s=cp;
atoi(s);
Reply:Post on cboard.cprogramming.com because you can post full, formatted code on there. Your code isn't complete here, but I already see problems.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment