C
Chris Ritchey
Hmmm I might scare people away from this one just by the title, or
draw people in with a chalange
I'm writting this program in c++, however I'm using char* instead of
the string class, I am ordered by my instructor and she does have her
reasons so I have to use char*. So there is alot of c in the code as
well
Anyways, I have a linked list of linked lists of a class we defined, I
need to make all this into a char*, I know that I need to allocate
them into one continuous chunk of data, ie remove all the pointers.
The way that I'm currently doing this is by manually placing the data
into the cahr* at appropriate placed using sizeof on the objects I'm
placing into the the char*.
I tried looking up people that were working with dynamic memory and
char*'s so see if they were using tokens in their char* then searching
for the tokens instead of just accessing the memory locations directly
based on the sizeof operator. I am experiencing some mind boggling
problems with the way I have it implemented, so I was wondering how
other people are implementing a similiar situation. Would it be better
to use tokens to seperate the data fields inside the char* or just
leave it to pointer arithmatic...
This is my first time converting anytype of data structure to a char*,
infact I didn't know you could do just cast another pointerto a char*
before I started working on this... sooo I'm basically looking for
any advice on teh above. Thanks in advacne for any suggestions that
are posted.
draw people in with a chalange
I'm writting this program in c++, however I'm using char* instead of
the string class, I am ordered by my instructor and she does have her
reasons so I have to use char*. So there is alot of c in the code as
well
Anyways, I have a linked list of linked lists of a class we defined, I
need to make all this into a char*, I know that I need to allocate
them into one continuous chunk of data, ie remove all the pointers.
The way that I'm currently doing this is by manually placing the data
into the cahr* at appropriate placed using sizeof on the objects I'm
placing into the the char*.
I tried looking up people that were working with dynamic memory and
char*'s so see if they were using tokens in their char* then searching
for the tokens instead of just accessing the memory locations directly
based on the sizeof operator. I am experiencing some mind boggling
problems with the way I have it implemented, so I was wondering how
other people are implementing a similiar situation. Would it be better
to use tokens to seperate the data fields inside the char* or just
leave it to pointer arithmatic...
This is my first time converting anytype of data structure to a char*,
infact I didn't know you could do just cast another pointerto a char*
before I started working on this... sooo I'm basically looking for
any advice on teh above. Thanks in advacne for any suggestions that
are posted.