Hi code as follows:

struct emaildetails
	{
	int used;
	char sender[100];
	char subject[100];
	char date[100];
	char header[1000];
	char content[5000];
	};

typedef struct myitem_tag {
    LPSTR aCols[C_COLUMNS];
} MYITEM;



//at the start:

struct emaildetails database[5000];

//instead of this being 5000 at the start, i need this to be redefinable as int totalemails throughout the program.

//later on:

MYITEM *pItem = LocalAlloc(LPTR, sizeof(MYITEM));

/*
i now need to copy the strings from emaildetails.sender etc. to the strings in *pItem.
also it would be nice if I could set the size of content for each of the 5000 emaildetails.
(hint hint tell me how to use pointers properly!)
*/
--------------------------------------------------------------------------
Pete says:
code?
Josh says:
done
Josh says:
check your emails
Pete says:
k
Josh says:
Hi code as follows:

struct emaildetails
	{
	int used;
	char sender[100];
	char subject[100];
	char date[100];
	char header[1000];
	char content[5000];
	};

typedef struct myitem_tag {
    LPSTR aCols[C_COLUMNS];
} MYITEM;



//at the start:

struct emaildetails database[5000];

//instead of this being 5000 at the start, i need this to be redefinable as int totalemails throughout the program.

//l
Josh says:
actually do check them cos it wont let me paste all of it
Pete says:
struct emaildetails *database;
database = malloc(sizeof(struct emaildetails) * totalemails);
Pete says:
then use database[i].jkfbkxf
Pete says:
for the pItem
Pete says:
thing
Josh says:
the totalemails replaces the 5000 right?
Pete says:
yeh
Josh says:
so i still get an array?
Pete says:
for the later bit. Why are you making it a pointer?
Pete says:
yeh
Pete says:
pointers == arrays
Josh says:
cos microsoft help made it a pointer
Pete says:
k, to access pItem you need to use pItem->aCols instead of pItem.aColts
Pete says:
and you can do strcpy(pItem->aCols[x], &database[y].sender);
Josh says:
ok
Josh says:
i think i got that
Pete says:
once you've done it zip up the binary and send it to me
Pete says:
(email as i may be afk)
Josh says:
did you see the bit about using a pointer instead of array 1000 for content
Josh says:
?
Pete says:
no, you didn't send it
Josh says:
ok basically i want to use an unsized array or a pointer for the database.content
Pete says:
also, for the pItem bit, you'll need to do pItem->aCols[x] = malloc(some length); before you can use it
Pete says:
in that case make it a char * and use database[x].content = malloc(size of string) and you don't need to change the rest of the code
Josh says:
ok thanks
Pete says:
by the way.. at the end you SHOULD do free(pItem->aCols[x]) etc. to remove memory leaks...
Josh says:
lol dont be silly
Josh says:
were losing 98k a time at the moment
Josh says:
*leaking
Pete says:
seriously though with that content thing, you could lose 5k / email...
Josh says:
also doesnt aCols have a set length defined in my resources
Josh says:
ok i will
Josh says:
ill just save this whole convo and do this another night
Josh says:
i seem to have loads of hw all at once
Pete says:
dunno, aCols is an array of pointers not a string
Josh says:
ill see if it works without and then if it doesnt do it with