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

Discussion in 'C Programming' started by AMT2K5, Oct 6, 2005.

  1. AMT2K5

    AMT2K5 Guest

    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.
     
    AMT2K5, Oct 6, 2005
    #1
    1. Advertising

  2. "AMT2K5" <> writes:

    >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.

    --
    Chris.
     
    Chris McDonald, Oct 6, 2005
    #2
    1. Advertising

  3. AMT2K5

    Mike Wahler Guest

    "AMT2K5" <> wrote in message
    news:...
    > 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
     
    Mike Wahler, Oct 7, 2005
    #3
  4. AMT2K5

    Dale Guest

    "AMT2K5" <> wrote in news:1128637420.381079.26390
    @g43g2000cwa.googlegroups.com:
    >
    > 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));
     
    Dale, Oct 7, 2005
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. dee
    Replies:
    9
    Views:
    517
    Joseph Byrns
    Apr 15, 2005
  2. Anand
    Replies:
    2
    Views:
    908
    Anand
    Sep 11, 2003
  3. Thomas Heller
    Replies:
    6
    Views:
    702
    Claudio Grondi
    Apr 9, 2005
  4. Plasmafire
    Replies:
    1
    Views:
    7,569
    Thomas Fritsch
    Jun 19, 2007
  5. Replies:
    1
    Views:
    138
    Kyle Peterson
    Dec 28, 2006
Loading...

Share This Page