Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

malloc, once again

Name: Anonymous 2010-11-03 8:25

I have a struct like
typedef struct { char* dildo; int etc } anus;.
Later on I want to make an anus array, with dildo being a string entered by the user.
Now how do I reserve the memory for dildo in my anus array?

So far I have:

typedef struct { char* dildo; int etc } anus;
...
char* small_dildo = fancy_input_routine();
anus* anii = (anus*) malloc(array_size * sizeof(anus));

With that I can't memcpy any small_dildo into my anii obviously, however I'm not quite sure how to do it.

Name: Anonymous 2010-11-03 12:25

>>5
If you're interested, I don't actually use chars to store a text string but to store bytes (including 0x00), so using string operations on that would be kind of stupid.
>>8
I've thought about that, but it's ugly.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List