C# :: Loading Large Text Files In A RichTextBox (OutOfMemoryException)

Mar 31, 2014

I am creating a simple log parser (loads a text file and filters out unnecessary information, but has the option to show the full log) and I'm running into an issue with fairly large log sizes (50+mgs). I have seen a few recommendations from a stream to memory manged files and even alternate 3rd party controls.

I foresee a few issues with any of the non-third party solutions (which I would prefer to avoid third-party add-ins) such as the scroll bar not correctly reporting the relative length or position of the complete text in the box (when displaying only a portion of the file at a time) and in the stream solution where you read on scroll (as necessary) have not only the same issues, but how do you resume reading in the middle of the file? This also all assumes I would be periodically clearing the RichTextBox to keep the memory usage down to avoid an OutOfMemoryException (which I have been running into.)

View 14 Replies


ADVERTISEMENT

C/C++ :: Loading File In Windows Form - Richtextbox

Feb 7, 2015

I want to load a file to rich text box component. I have this line:

richTextBox1->LoadFile("StudentaiRez.txt", RichTextBoxStreamType->PlainText);

But I get an error when I try to pass second parameter. It says : type name is not allowed.

I probably write it wrong, but I can't remember the correct way. In examples I only see that instead of -> dot is used, but it doesn't work either.

View 1 Replies View Related

C# :: Cannot Update Text In Richtextbox Using Class

Oct 21, 2014

It's my understanding that there are three ways to go about updating a control on a form from a class.

A) Instance the form, eg: Form1 Frm = new Form1();
The problems I have run into with this is that while writing text to a richtextbox using the instance Frm, the richtextbox never updates on the form.

B) Passing the object to the class.
This method seems less used and can be very problematic. Haven't looked into it thoroughly.

C) Exposing the objects using classes within the Form.
While making methods public they still do now show as available for use when calling from classes, unless I instance them but then I run into problem A. I've considered making the methods static so no instancing is required but when doing so the object(in this case richtextbox) becomes invalid due to itself being instanced by the automatically generated code when adding the object.

I know there is another way to pass values then force the object to update but that won't necessarily work with a richtextbox as you have the option to deal with color and font variations.

I imagine I'm missing something pretty simple here but I can't find any resources online about how to handle objects with more complex data than just straight text.

Example of problem A

//called from a class
Form1 Chat = new Form1();
Chat.BeginChat();
Chat.AddChat(Color.Lime, "Testing");
Chat.EndChat();

[Code]....

View 14 Replies View Related

C++ :: Loading Menu For Files

Jun 11, 2014

I would like to make a program that automatically launches and loads a file when a file of that file type is double clicked within windows. As said I am unsure where to look for some information as to how to do that, and so turn to you all. Is there a simple way of doing such a thing without using any external libraries, if so, a simple tutorial or link to a reference for this; if there is no way of doing this without externals what would be a small and simple to use library for this?

View 2 Replies View Related

C++ :: SDL2 Framework - Loading MBP Files In Same Folder In XCode 5

Feb 23, 2014

I am trying to load a .bmp file located in the same folder as main.cpp etc. but I'm not sure what to input as the resource path so that it picks it up and, when I distribute it, I want it to be preferably cross platform and run smoothly.

I have tried using:

hello_world.bmp
SDL_Game/hello_world.bmp (SDL_Game is the name of the project)

but it will work if I use the full path. I don't want to do this though, because then it will not work on other computers and platforms.

This is the function I use to load media:

bool loadMedia() {
// Loading success flag
bool success = true;

// Load splash image
gHelloWorld = SDL_LoadBMP("hello_world.bmp");

[Code] ....

I am using XCode 5, SDL2.0.1, OSX 10.9 Mavericks and C++.

View 2 Replies View Related

C++ :: Reading Large Number Of Binary Files

Apr 14, 2014

Windows 7, 64 bits, Visual Studio 10.

I have a problem to read a large number of binary files, process them and store them under a new name. The program and routines go very well for 505 files. After reading 506 files, the program now refuses to read the next file. I have 16 Gb of memory and tried to close all other programs and restart the PC. it always stops after 506 files (512 files would be more understanding in a way...).

Here is my code. I have tried many things without success. This is only part of the loop that stops. The if test if (myfile.is_open() returns false by some reason. I can start the process again starting with the file that does not open and then it stops again after 506 files.

char * tfiBlock;
ifstream myfile (OrigFilename, ios::in|ios::binary|ios::ate);
if (myfile.is_open()) {
int lengde = myfile.tellg();
tfiBlock = new char [lengde];
//static char memblock [size];

[Code] .....

Clean up procedure:
delete[] tfiBlock;

Are there any limits to how many files that can be opened, or is it maybe someting to be set in the compiler?

View 5 Replies View Related

C++ :: Printing To Multiple Files Because Output Is Too Large?

Apr 18, 2013

I have managed to make a program that permutates a string with repetition.

I ran it to permutate "abcdefghijklmnopqrstuvwxyz1234567890" with a limit of 5 characters.

This took a little over 5 hours for my pc to process this and I ended up with a .txt 403MB in size. Needless to say I am unable to open this .txt in notepad without Notepad.exe not responding and me having to end the process.

So what I want to do is modify my code to break up the output in to several files rather than one. Possibly all permutations starting with a in one file, b in another, etc.

Here is my current code:
#include <iostream>
#include <string>
#include <sstream>

[Code]....

As you can see it currently appends permutation.txt with all output. I would like it to make files like this permut_5char_a.txt, permut_5char_b.txt, etc.

View 12 Replies View Related

C++ :: Processing Large Files - Getting A Specific Line

Jul 5, 2012

I am reading in some large files to process. The files need to be parsed into multi-line sub units for processing (by a different physical process). My current setup is crude and parses the entire file into memory before beginning to process the sub units. This is fine as long as the file fits, so I get into trouble > 2GB or so when my machine flat runs out of memory. The simple thing to do is to only read in some of the file, process what was read in, and then read in more. I more or less know how to stop reading at some point in the file, but I'm not sure how to resume from that point later when I need more data. Is there a way to count lines and then getline() starting from a specific point in the file? From reading the getline() doc, it doesn't look like there is.

This is my current function,

Code:
void ParseFile(char *path, char type) {
// open input file
ifstream input_file(path);
if( !input_file.good() ) { cerr << "Failed to open " << path << endl; exit(ERRCODE_ERROR); }
int pos = 1;

[Code] ....

I need to remove the code to open the file from this function and open it elsewhere. I would like to call this every time I run out of data, if( tasks.empty() ), and get more data from the input file, but I don't know how to resume reading the input file from where I left off.

If this is not possible, I guess I would have to place a function call in while( input_file.good() ) to call out and process the data I have. When the current tasks list is finished, the list could be cleared and control returned into the while loop to continue reading input and start re-populating the list.

View 2 Replies View Related

C++ :: Read A Folder That Contains Large Number Of TIFF Files?

May 21, 2014

I want to read a folder that contains large number of tif files. (say 1000 tif images) requirement is to read all files and store in a array/array pointer.

View 1 Replies View Related

C++ :: Multiplethread - Sequentially Process Large Number Of Files

Jan 14, 2014

We have a program that sequentially processes a large number of files (currently about 700 expected to increase to about 1500). The program performs the same processing on each file (and doesn't involve any other file) which is io-bound and not cpu-bound. This process takes several hours and it is normally performed overnight.

I've refactored the program so that the processing for each file is done within its own thread (ie one thread created for the processing of one file). This gives rise to many hundreds of io-bound threads. This refactored program is working with no errors reported and has reduced the total processing time down to about 10 minutes.

Any problems that might arise having this number of threads (700 to 1500) created/running?

View 14 Replies View Related

Managed C++ And C++/CLI :: Breaking Up Large Class Into Manageable Source Files?

Feb 9, 2015

I'm trying to make sure my code is written in smaller modules, so my first step is to create my initialization process in and external file to load the necessary data from external sources and set up things like the content of drop down list boxes.

My first attempt failed to give me access to the combobox items add function so I moved that code back into the form1.h file:

Code:
public:
Form1(void) {
InitializeComponent();
//
//TODO: Add the constructor code here
//
}
void AddDate(char *date, int ID)
{
this->comboBox1->Items->Add("line 1");
}

It compiles fine, but the call to it in my Initialize.cpp file

Code:
MarketView::Form1::AddDate("abs",1);
Gives error C2352: 'MarketView::Form1::AddDate' : illegal call of non-static member function

OK, so I change "void AddDate" to "static void AddDate" and now get the error that "static member functions do not have 'this' pointers" so I go back to the "MarketView::Form1::comboBox1" situation where there is no legal syntax after "Box1 to get me to Items->Add

I've been an old fashion programmer for over 47 years. It seems as is the concept of programming computers has changed from the concepts of logic to memorization of complex syntax.

There has to be a simple answer to do this other than to write thousands of lines of code in one Form1.h file. I refuse to believe that the new programming concepts will not allow you to write code in smaller more manageable modules.

What is the proper syntax for breaking up the larger file into more manageable chucks?

View 12 Replies View Related

C :: Loading Text File To Array

Jul 19, 2013

I'm having troubles with loading my text file into my array.

Code:

int main(int argc,char* argv[]) {
if(argc!=3) {
printf("
Insufficient arguments

[code]...

I'm also suppose to return the size of the input at the end.

View 3 Replies View Related

C/C++ :: Loading Data From Text File Into Array

Jan 25, 2015

I am currently working on a project that requires me to "load the data in the file into array at the beginning of the program."

I have a text file with data, and I need to populate an array with the information. From then on, I am supposed to be able to add, display, and search that array. However, I can't figure out how to add the data from the file into an array. I was trying to find out how to search the text file itself. So it threw me off balance and I've been staring so long at the screen I can't really focus.

View 7 Replies View Related

C++ :: Pointer-based Data Loading From A (text) File

Dec 4, 2013

I have two classes, productListType and buyerListType, that are each basically linked lists. To create the linked list for an object of productListType, I successfully wrote a non-class function createProductList to read the product data from a text file. The class definition for buyerListType has a data member productBoughtRecord that is of type productListType to aggregate the details of the products purchased by a particular buyer during transactions. I decided to make productBoughtRecord a pointer since the contents of this data member would wax and wane over the course of several transactions, depending on the amount and frequency of payments made by the buyer. I have provided a rough sketch of the class below:

class buyerListType
{
public:
setCustomerInfo( ....., productListType* p);
.
.
.
private:
productListType* productBoughtRecord;
.
.
};

I'm similarly trying to write a non-class function createBuyerList to load the record of customers from a text file. How do I determine what the value of the formal parameter p in member function setCustomerInfo is, in order to be able to set the data member productBoughtRecord? take into consideration that an object of class buyerListType would have multiple buyers with varying amounts of products purchased.

View 11 Replies View Related

C++ :: Parsing Large Text File

Feb 10, 2013

I have a massive text file containing many thousands of directory and file names with / at the root, like so:

/dir/
/dir/dir/
/dir/dir/dir/
/file
/dir/file
/dir/dir/file
/dir/dir/dir/file

I need to parse the file in such a way that I can create a filesystem hierarchy as if I were enumerating files/directories. Ultimately I want to add these to a tree gui control with everything under its proper node without duplicating anything. It should look roughly like so:

dir
-file
-dir
-file
-dir
-file

I can open the file and add nodes/children to the tree control but how should I go about doing the actual parsing? How can I find a filename and say "this belongs under this node"? I want to do this efficient as possible even if I must use multiple threads.

View 1 Replies View Related

Visual C++ :: Open Large Files - Save Video As Long As Users Have Space In Hard Disk

Jan 15, 2013

Opening large files in c++. In my application, i am trying to save video as long as users have space in harddisk. What I am trying to do is when user is recording video i am trying to append the video data in to the file. The problem is that every time file size reach over 2GB my software crashes.

View 5 Replies View Related

C++ :: Display Last 1000 Lines From Multiple Text Files (log Files)

Jan 16, 2014

I am writing a piece of code that requires me to display the last 1000 lines from a multiple text files (log files). FYI, I am running on Linux and using g++.

I have a log file from which - if it contains more than 1000 lines, I need to display the last 1000 lines. However, the log file could get rotated. So, in case where the current log file contains less than 1000 lines, I have to go to older log file and display the remaining. For e.g., if log got rotated and new log file contains 20 lines, I have to display the 980 lines from old log file + 20 from current log files.

What is the best way to do this? Even an outline algorithm will work.

View 6 Replies View Related

C :: Program To Show Large Text File In Parts

Jan 1, 2014

I am currently working out on a problem in which a c program is to be made which shows a large text file in parts.
f
For example: If file contains 200 lines. 50 lines will be shown on first page and user is asked to press any key to move to next page until EOF is found. user is allowed to return to previous page as well, and this is very complicated task for me. I tried to move cursor to a specific position using fseek etc but it page doesn't stop and reaches to end quickly.

View 1 Replies View Related

C :: Program That Takes A Large Text File As Input

Nov 7, 2014

I am writing a spell checker for a exercise for a class I am taking online. I have to load a huge text file of 143092 words into a hash table.

The program segfaults on word number 63197. Is there a way to debug this in gdb without having to step threw the function 63197 times.

View 3 Replies View Related

C/C++ :: Program That Opens Text File And Checks Usernames Listed In Text Files?

Jun 5, 2014

I want to make a program that opens a text file and checks the usernames listed in the text files to see if the names are registered on a site such as twitter. How easy would this be to make, what things would I need to know?

View 4 Replies View Related

C# :: How To Use Textbox For Richtextbox

Nov 22, 2014

This is a simple dictionary program, richtextbox is used for a results

but i wants to use textbox as a richtext box

(ex:money = dollar,penny,rupees)
as a list : dollarpennyrupees

/> /> /> />

Project 2 Dic.txt = Project 2 Dic.rar

Attached File(s) : Project 2 Dic.txt (61.32K)

View 1 Replies View Related

C Sharp :: How To Get Selected Row Value From Datagridview In Richtextbox

Feb 18, 2013

i have 10 column in my datagridview. i want to get whole value from row(which row i'll select). i have this code but it's shows only one cell value,

richtextbox.Text = dataGridView1.CurrentCell.Value.ToString();  

View 1 Replies View Related

C# :: Searching Through A RichtextBox For Specific Words And Display It?

Dec 28, 2014

I am building a c# application that would be able to search for specific words and display the frequency of each match and their respective values.All these is done by uploading a file into a rich texbox then read through it ,I have it uploading a file and read it and count the words but I cant get to search all the words at the same time in the richtextbox say I have RE3409RT,RE6789GH,DG7654YU,I want to go through all these codes and give how many times each occurs is working and when I specifically declare it say string srch="RE3409RT";

Find below is my code so far.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

[code].......

View 1 Replies View Related

C++ :: Calculations From Text Files?

Mar 31, 2014

I have a text file that contains values as follows:

2013 05 27 15 52 02.049824 231.401 0.022 49.738 2013 05 27 15 52 02.668822 229.814 0.019 49.738 2013 05 27 15 52 03.283705 228.528 2.599 49.726 2013 05 27 15 52 03.898469 230.140 2.576 49.751
Column1=date, Column2=Month, Column3=Day, Column4=Hour, Column5=Minute, Column6=Seconds, Column7=Voltage(Vrms), Column8=Current(Irms), Column9=Frequency(Hz).

I have to develop a program that will analyse these time-sampled voltage and current measurements over 24 hours and find the total energy used, mean and peak power consumption and Energy used over each hour of the 24 hour period.

How do I go about doing this? I also need to include at least one numerical integration technique. The file data contains over 50 thousand lines in the format mentioned above.

View 2 Replies View Related

C++ :: Merging Two Int Text Files?

Jun 16, 2014

I have come up with code for this, but am currently having issues finalizing it. It seems that it only puts out some of the numbers in a numerical order, but not all from both text files.

#include <iostream>
#include <fstream>
#include <cmath>

[Code]....

View 9 Replies View Related

C++ :: Output 2 Different Text Files

May 22, 2013

So I'm trying to output 2 different text files, one has customer names and the other has items they are selling. I gave each customer an ID and each of their items has the same ID. Only problem is when I try to output it, it only outputs the first item with the same ID. I do not want to display the ID number at all, I think getline would show it so I am not using it.

here's my code

ifstream infile, infile2;
string Fname, Lname, email, item, itemPrice;
int id, itemID;
infile.open("Data.txt");
infile2.open("ItemList.txt");

[Code] .....

The first customer shirt item isn't being outputted. Maybe I'm reading the or comparing the info wrong or just not seeing it.

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved