Large Char Array!

Posts 111 of 11 · Page 1 of 1
Large Char Array!
I need help creating a long char array. Or is there a much simpler way to do this? I dont want to type it out to 30000. Is there a much shorter way to do this?

char *num[] = { "1", "2", .., "29000", "30000" };
Dude come on this is easy... I'll give you something to work with...
Code:
int yourgayarray[];
for( int i =0; i < 3000; i++ ) 
{
yourgayarray[i] = i;
}
use ints its better and easier
Quote Originally Posted by matypatty View Post
Dude come on this is easy... I'll give you something to work with...
Code:
int yourgayarray[];
for( int i =0; i < 3000; i++ ) 
{
yourgayarray[i] = i;
}
use ints its better and easier
He asked for a Char Array, Not an array of integers.......

same principle apply's

for i:= 0 to 3000 do
CharArray[i]:= IntToStr(i); <--- convert Integer to a String..
Quote Originally Posted by Departure View Post
He asked for a Char Array, Not an array of integers.......

same principle apply's

for i:= 0 to 3000 do
CharArray[i]:= IntToStr(i); <--- convert Integer to a String..
Sprintf should do the job.
Quote Originally Posted by Braco22 View Post
I need help creating a long char array. Or is there a much simpler way to do this? I dont want to type it out to 30000. Is there a much shorter way to do this?

char *num[] = { "1", "2", .., "29000", "30000" };
Code:
int len = 30000;
char* num[] = new char*[len];
for (int i = 0; i < len; i++)
  num[i] = iota(i);
Present!

Quote Originally Posted by matypatty View Post
Dude come on this is easy... I'll give you something to work with...
Code:
int yourgayarray[];
for( int i =0; i < 3000; i++ ) 
{
yourgayarray[i] = i;
}
use ints its better and easier
Unfortunately, you can't just assume that without knowing what the purpose of the array is.
Use a For loop and Sprintf function
Quote Originally Posted by Departure View Post
He asked for a Char Array, Not an array of integers.......

same principle apply's

for i:= 0 to 3000 do
CharArray[i]:= IntToStr(i); <--- convert Integer to a String..
where would i place this. i can't put it as global though.

i am doing this

Code:
	for(int i = 0;  i < 30000; i++)
	{
		largeArray[i] = (char *)i;
	}
but my menu crashes when i want to turn on the hack to like 500

another method i tried but crashes

Code:
	char buffer [ FILENAME_MAX ];
    for(int i = 0;  i < 30000; i++)
	{
		sprintf(buffer, "%d", i);
		largeArray[i] = buffer;
	}

	return 0;
Quote Originally Posted by Braco22 View Post
where would i place this. i can't put it as global though.

i am doing this

Code:
	for(int i = 0;  i < 30000; i++)
	{
		largeArray[i] = (char *)i;
	}
but my menu crashes when i want to turn on the hack to like 500

another method i tried but crashes

Code:
	char buffer [ FILENAME_MAX ];
    for(int i = 0;  i < 30000; i++)
	{
		sprintf(buffer, "%d", i);
		largeArray[i] = buffer;
	}

	return 0;
In this loop, i is an of an int data type. You are referencing it in your sprintf method call as a double (%d)
Code:
 for(int i = 0;  i < 30000; i++)
	{
		sprintf(buffer, "%i", i);
		largeArray[i] = buffer;
	}
Quote Originally Posted by Braco22 View Post
where would i place this. i can't put it as global though.

i am doing this

Code:
	for(int i = 0;  i < 30000; i++)
	{
		largeArray[i] = (char *)i;
	}
but my menu crashes when i want to turn on the hack to like 500

another method i tried but crashes

Code:
	char buffer [ FILENAME_MAX ];
    for(int i = 0;  i < 30000; i++)
	{
		sprintf(buffer, "%d", i);
		largeArray[i] = buffer;
	}

	return 0;
LOL

Code:
	char* largeArray[30000];
        for(int i = 0;  i < 30000; i++)
	{
                char buffer [ 0x10 ];
		sprintf_s(buffer, "%d", i);
		largeArray[i] = buffer;
	}

	return 0;
Code:
char* None[30000];
for (int Of = 0; Of < 30000; ++Of)
{
	char* YouKnowCPP = new char[15];
	_itoa(Of, YouKnowCPP, 10);
	None[Of] = YouKnowCPP;
}
Why do a char when it's easier to do an int but w/e
Posts 111 of 11 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Need help?