Jump to content

string array

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
5 replies to this topic

#1
Guest_norman_069_*

Guest_norman_069_*
  • Guests
Hello,

I am trying to declare a string array that looks like this

string quest[4000][30];

It will compile but everytime i run i get the error message

''An unhandled exception of type 'System.StackOverflowException' occurred in 3304.exe''

If i take the array from 4000 down to 362 it works but at 363 or higher i get the message. does anyone know why. also is there a way to take a line of text and have it start and stop at certain characters such as '<' and '>' and have it save that as a string in an array.

If you can help the first question is most important.

thanks

#2
MeTh0Dz

MeTh0Dz

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 2,119 posts
What are you doing that you need that big of a 2-dimensional array?

#3
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
creating an array of 120,000 strings is likely to use a LOT of memory.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#4
Guest_norman_069_*

Guest_norman_069_*
  • Guests
ok i figured out the stack error but now i need to know about the string and the character with in the string. I need a way to read a sentence like <aaaa>bbbb</cccc> with no spaces and be able to seperate it using the charachters < and >. so i get three string <aaaa> and bbbb and </cccc>.
let me know if you can help

thanks

#5
revealer

revealer

    Newbie

  • Members
  • Pip
  • 9 posts
You should create a char array instead of a string array.
Then you could use strtok() for splitting each array.

#6
dargueta

dargueta

    Writes binary right handed and hex left handed

  • Moderators
  • 4,720 posts
You could also use scanf to split the array much faster. For example:
scanf("<%s>%s</%s>",str1,str2,str3);