Ask your own question, for FREE!
Computer Science 8 Online
OpenStudy (mimi_x3):

question

OpenStudy (mimi_x3):

@wio HI

OpenStudy (mimi_x3):

but i have to extract the buffer and put it into a linkedlist?

OpenStudy (anonymous):

Is the buffer supposed to be a linked list?

OpenStudy (anonymous):

The size of your pointers is going to be like 4 or 8 while the size of your characters is just 1, so linked lists have a ton of overhead.

OpenStudy (anonymous):

Oh, ok. I see.

OpenStudy (mimi_x3):

do i iterate through the text array?

OpenStudy (anonymous):

Okay, so what I think you want to do here is you want to search for `'\n'`, and use pointer arithmetic to find how many characters are on the line. Malloc that amount of characters and insert them into the list.

OpenStudy (anonymous):

Let me think about this for a bit

OpenStudy (mimi_x3):

ok

OpenStudy (anonymous):

I think we want to create a helper function for this

OpenStudy (mimi_x3):

what's a helper function?

OpenStudy (anonymous):

It's just a function that does a simpler task

OpenStudy (anonymous):

We want to create a function `addLine(TB tb, char* start, int length)`

OpenStudy (anonymous):

In this function we will 1. Malloc a char array the size of length (+1 for '\0') 2. Copy from line into our malloc array into this new char array 3. Point our textbuffer at this malloc array

OpenStudy (anonymous):

I have a question... do you know any more details about how TB should work?

OpenStudy (anonymous):

It says something about Query functions

OpenStudy (mimi_x3):

ye that's the other functions

OpenStudy (anonymous):

I would sort of like to know what functions you need to implement so that I can help you design it.

OpenStudy (mimi_x3):

do you have skype?

OpenStudy (anonymous):

Yes

OpenStudy (mimi_x3):

whats yours?

OpenStudy (anonymous):

PM me and I'll add you

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!