TIP: Click on subject to list as thread! ANSI
echo: nthelp
to: Geo
from: Paul Ranson
date: 2004-11-23 01:00:34
subject: Re: C++ for beginners?

From: "Paul Ranson" 

I'm guessing you allocated this as an 'automatic', IOW on the stack. Your
exe probably has a maximum stack size of 1MB. So bang.

Simplest would be to make your stack bigger, this is usually a linker option.

Or allocate on the heap, this is the proper choice but you are going to
enter a really dark cavern if you go this way.

Try,

char (*loglines)[256] = new char [4096][256] ;

use as you would your declaration and at the end it's polite to call,

delete [] loglines ;

You can vary the 4096 at run time.

I need to say that this is not the right approach, you should create a
std::vector of std::string. But I guess this isn't covered yet. Have fun
debugging...

Paul

"Geo"  wrote in message
news:41a27985$1{at}w3.nls.net...
> "Ellen K."  wrote in message
> news:5ls4q0lkbad640ph8hda115n0ge1p4f939{at}4ax.com...
>
>> Arrays of user-defined types are VERY lightweight and very fast, I have
>> to say.
>
> in C++ arrays appear to be limited in size, I tried to create a 2
> dimensional array to hold a 4mb log file and the program blew up on the
> array definition every time. Basically the log file was a bunch of text
> lines with a length of 254 or less so I defined an array
> char loglines{4096][256]
>
> but it didn't seem to like that at all.  Haven't had time to ask teach why
> yet. Anyone want to take a stab at it?
>
> Geo.
>
>

--- BBBS/NT v4.01 Flag-5
* Origin: Barktopia BBS Site http://HarborWebs.com:8081 (1:379/45)
SEEN-BY: 633/267 270 5030/786
@PATH: 379/45 1 396/45 106/2000 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.