String is left containing the data originally passed to the function?

A

AMT2K5

Hello,

I have an assignment to do in class which requires me to create a
single line editor not a multi-line editor.

I am confused about what this means, I would appreciate any
clarification.

"IF "TB" is false (0): [single line edit]
Pressing TAB and ESCAPE will terminate the cio_edit(). If ESCAPE is
used, then editing is aborted - the string is left containing the data
originally passed to cio_edit();

Well, so far I have

case ESC_KEY:
if(!TB){end = 1;}
else{ //string must contain original data and forget
editing?}
break;

I am unsure if that is exactly what this assignment wants and how
abouts I would do that.

Thanks in advance.
 
C

Chris McDonald

AMT2K5 said:
I have an assignment to do in class which requires me to create a
single line editor not a multi-line editor.

.....

I am unsure if that is exactly what this assignment wants and how
abouts I would do that.


We, here, do not know.
The best approach will (surely) be to ask the instructor/professor who
is setting and grading the assignment.
 
M

Mike Wahler

AMT2K5 said:
Hello,

I have an assignment to do in class which requires me to create a
single line editor not a multi-line editor.

I am confused about what this means, I would appreciate any
clarification.

"IF "TB" is false (0): [single line edit]
Pressing TAB and ESCAPE will terminate the cio_edit(). If ESCAPE is
used, then editing is aborted - the string is left containing the data
originally passed to cio_edit();

This implies to me that your edit function is modifying
the passed string 'in place'.

What your function will need to do is first make a copy of
the passed string. THen have it make modifications to the copy.
If the edit is not cancelled, copy the characters back to the
passed string, otherwise, don't.
Well, so far I have

case ESC_KEY:
if(!TB){end = 1;}
else{ //string must contain original data and forget
editing?}
break;

I am unsure if that is exactly what this assignment wants and how
abouts I would do that.

Well, the only way to know for sure is to consult with whomever
gave the assignment.

-Mike
 
D

Dale

AMT2K5 said:
Hello,

I have an assignment to do in class which requires me to create a
single line editor not a multi-line editor.

I am confused about what this means, I would appreciate any
clarification.

"IF "TB" is false (0): [single line edit]
Pressing TAB and ESCAPE will terminate the cio_edit(). If ESCAPE is
used, then editing is aborted - the string is left containing the data
originally passed to cio_edit();

Well, so far I have

case ESC_KEY:
if(!TB){end = 1;}
else{ //string must contain original data and forget
editing?}
break;

I am unsure if that is exactly what this assignment wants and how
abouts I would do that.

Thanks in advance.

Hint:

memcpy(temp_storage, original_string, strlen(original_string));
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top