Results 1 to 11 of 11
  1. #1
    Braco22's Avatar
    Join Date
    Jul 2010
    Gender
    male
    Posts
    150
    Reputation
    12
    Thanks
    607

    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" };

  2. #2
    matypatty's Avatar
    Join Date
    Aug 2009
    Gender
    male
    Posts
    864
    Reputation
    229
    Thanks
    2,694
    My Mood
    Amused
    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
    Last edited by matypatty; 08-30-2011 at 10:15 PM.

  3. #3
    flameswor10's Avatar
    Join Date
    Jul 2009
    Gender
    male
    Posts
    12,528
    Reputation
    981
    Thanks
    10,409
    My Mood
    In Love
    Use a For loop and Sprintf function
    No I do not make game hacks anymore, please stop asking.

  4. #4
    Departure's Avatar
    Join Date
    Nov 2010
    Gender
    male
    Posts
    805
    Reputation
    125
    Thanks
    1,794
    My Mood
    Doh
    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..

  5. #5
    flameswor10's Avatar
    Join Date
    Jul 2009
    Gender
    male
    Posts
    12,528
    Reputation
    981
    Thanks
    10,409
    My Mood
    In Love
    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.
    No I do not make game hacks anymore, please stop asking.

  6. #6
    Braco22's Avatar
    Join Date
    Jul 2010
    Gender
    male
    Posts
    150
    Reputation
    12
    Thanks
    607
    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;
    Last edited by Braco22; 08-31-2011 at 07:03 AM.

  7. #7
    _Fk127_'s Avatar
    Join Date
    Nov 2010
    Gender
    male
    Posts
    720
    Reputation
    16
    Thanks
    208
    My Mood
    Bitchy
    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;
    	}



    Put this image in your signature if you support HTML5 development!

  8. #8
    ISmokeWeedAmICoolNow's Avatar
    Join Date
    Aug 2011
    Gender
    male
    Posts
    54
    Reputation
    10
    Thanks
    19
    My Mood
    Bitchy
    Code:
    char* None[30000];
    for (int Of = 0; Of < 30000; ++Of)
    {
    	char* YouKnowCPP = new char[15];
    	_itoa(Of, YouKnowCPP, 10);
    	None[Of] = YouKnowCPP;
    }
    Last edited by ISmokeWeedAmICoolNow; 08-31-2011 at 02:13 PM.

  9. The Following 2 Users Say Thank You to ISmokeWeedAmICoolNow For This Useful Post:

    matypatty (09-03-2011),OBrozz (09-01-2011)

  10. #9
    freedompeace's Avatar
    Join Date
    Jul 2010
    Gender
    female
    Posts
    3,033
    Reputation
    340
    Thanks
    2,792
    My Mood
    Sad
    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.
    Last edited by freedompeace; 09-02-2011 at 02:08 AM.

  11. #10
    matypatty's Avatar
    Join Date
    Aug 2009
    Gender
    male
    Posts
    864
    Reputation
    229
    Thanks
    2,694
    My Mood
    Amused
    Why do a char when it's easier to do an int but w/e

  12. #11
    topblast's Avatar
    Join Date
    Mar 2010
    Gender
    male
    Location
    Far from around you Programmer: C++ | VB | C# | JAVA
    Posts
    3,607
    Reputation
    149
    Thanks
    5,052
    My Mood
    Cool
    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;
    I just like programming, that is all.

    Current Stuff:

    • GPU Programmer (Cuda)
    • Client/Server (Cloud Server)
    • Mobile App Development

Similar Threads

  1. [Help] Char Arrays [Solved]
    By kibbles18 in forum C++/C Programming
    Replies: 8
    Last Post: 09-23-2011, 04:28 PM
  2. [Help] Intializing Large Character Array [Solved]
    By Braco22 in forum C++/C Programming
    Replies: 26
    Last Post: 09-01-2011, 10:43 PM
  3. array of chars to byte
    By Sintax1 in forum C++/C Programming
    Replies: 2
    Last Post: 04-02-2011, 10:44 AM
  4. [HELP] Saving Char* Arrays in Structure.
    By topblast in forum Combat Arms Coding Help & Discussion
    Replies: 7
    Last Post: 01-17-2011, 01:19 PM
  5. Where can i upload large pics?
    By NukeAssault in forum General
    Replies: 6
    Last Post: 06-25-2006, 05:14 PM