Home || Visual Search || Applications || Architecture || Important Messages || OGL || Src

bool OglGui::TextEdit::ReadFile ( strconst  fileName  )  [inline]

Definition at line 216 of file TextEdit.h.

References mSingleLine, and SetText().

Referenced by Impala::Visualization::GUI::HelpViewer::Init(), and OglGui::InfoViewer::Init().

00217     {
00218         if (mSingleLine)
00219             return false;
00220 
00221         int nBytes = -1;
00222         FILE *fp = fopen(fileName.c_str(), "rb");
00223         if (fp)
00224         {
00225             fseek(fp, 0, SEEK_END);
00226             nBytes = ftell(fp);
00227             fseek(fp, 0, SEEK_SET);
00228             char* buf = (char *) malloc(nBytes+1);
00229             if (buf)
00230             {
00231                 nBytes = fread(buf, sizeof(char), nBytes, fp);
00232                 buf[nBytes] = '\0';
00233                 // Get rid of 13 10 newline combinations
00234                 char *tmpBuf = (char*) malloc(nBytes+1);
00235                 if (tmpBuf)
00236                 {
00237                     int ind=0;
00238                     for (int i=0; i<=nBytes; i++)
00239                         if (buf[i] != 13)
00240                             tmpBuf[ind++] = buf[i];
00241                     SetText(tmpBuf);
00242                     free(tmpBuf);
00243                 }
00244                 else
00245                     SetText(buf);
00246                 free(buf);
00247             }
00248             else
00249                 nBytes = -1;
00250             fclose(fp);
00251         }
00252         return nBytes != -1;
00253     }

Here is the call graph for this function:


Generated on Thu Jan 13 09:27:04 2011 for ImpalaSrc by  doxygen 1.5.1