Home » Community » Newbie corner » Problem loading very large data files (The system hangs up when loading data from large files.)
Re: Problem loading very large data files [message #61452 is a reply to message #61448] |
Fri, 14 February 2025 16:46   |
DMStevenson
Messages: 6 Registered: January 2025 Location: Wisconsin
|
Promising Member |
|
|
Thanks for the reply Koldo. As a Newbie I continue to learn quickly, and have found that, over time, my large files do load, but they simply do not appear in a DocEdit for a while. For the code below I expected the contents of a file to appear line-by-line. Instead it seems to completely fill a buffer and *then* is posted to the DocEdit. Am I correct in this? My aim is *NOT* to fill a DocEdit with a huge amount of text, but I was doing this just as a programming step... Thanks, DMStevenson
#include <CtrlLib/CtrlLib.h>
using namespace Upp;
struct WindowType : TopWindow {
Button button;
String FileName;
DocEdit memo;
Progress progress1;
Vector<String> DataLines;
void ReadFile(String file_name) {
String line;
FileIn infile;
if (infile.Open(file_name)) {
while(!infile.IsEof()) {
line = infile.GetLine();
memo.Append(line);
memo.Append("\n");
DataLines.Add(line);
}
}
infile.Close();
}
WindowType()
{
Title("File Read");
button << [=] {
FileName = SelectFileOpen("All Files\t*.*");
ReadFile(FileName); };
button.SetLabel("Get File");
Add(button.LeftPos(10, 60).TopPos(10, 30));
Add(memo.LeftPos(10, 680).TopPos(50, 430));
}
};
GUI_APP_MAIN
{
WindowType app;
app.SetRect(0,0,700,500);
app.Run();
}
|
|
|
Goto Forum:
Current Time: Thu Aug 07 20:50:43 CEST 2025
Total time taken to generate the page: 0.03630 seconds
|