Thread: Hello!! need help with a problem plz!!

  1. #1
    Registered User
    Join Date
    Nov 2001
    Posts
    32

    Talking Hello!! need help with a problem plz!!

    I hope that someone can help me with this.

    Lets say that I want to let the user of a program edit the text in a file..

    Then of course he must be able to print text, and remove text.

    I dont want to work against the file directly, but against a file buffer, lets say that it would be called textBuffer[].

    the start location in the edit mode, would be after the last character in the textBuffer[] array..

    if the user presses backspace, one char at the time will be removed from the textBuffer[] array, the screen would have to be cleared, and the textBuffer[] array outputted to the screen again..

    the user should also be able to print something to the textBuffer[], where ever he is lokated, exept at textBuffer[tb_size] location ofcourse..

    **The filehandling part is already done, so I dont need help with that... But I would really appriciate if someone could help me with the other stuff.

    Thanks in advance!!

  2. #2
    Mayor of Awesometown Govtcheez's Avatar
    Join Date
    Aug 2001
    Location
    MI
    Posts
    8,823
    If your file handling's done, what else is there?

  3. #3
    Unregistered
    Guest
    [code]
    int lengthtb = strlen(textbuffer);

    switch(textbuffer)
    {
    case WM_RIGHT:
    //blah
    break;
    case //blah
    //blah
    }

  4. #4
    Registered User
    Join Date
    Nov 2001
    Posts
    32

    Unhappy This!!

    The part that is letting the user, edit the text that is stored in the textBuffer[] array, after they have done this I will save it to the file, that they shoosed to edit, and the text in that file is located in the textBuffer[] array...

    aaah I really thought that I was so clear in the above description!!

  5. #5
    Registered User
    Join Date
    Nov 2001
    Posts
    32

    Talking Hmm...

    Originally posted by Unregistered
    [code]
    int lengthtb = strlen(textbuffer);

    switch(textbuffer)
    {
    case WM_RIGHT:
    //blah
    break;
    case //blah
    //blah
    }

    Hmm what can I say...
    This was not really what I was looking for... what ever it is

  6. #6
    Registered User
    Join Date
    Nov 2001
    Posts
    32

    Unhappy Hmm Beginners, only Beginners

    Are everyone beginners at this board.. Isnīt there anyone who could help me with this problem???

  7. #7
    Registered User
    Join Date
    Nov 2001
    Posts
    32

    Angry Oh well...

    I have only one thing to say..
    vbworld forums, here I come....

  8. #8
    S­énior Member
    Join Date
    Jan 2002
    Posts
    982
    >aaah I really thought that I was so clear in the above description!!

    Clear as mud. Either you want a very simple explanation -

    Use a variable as the offset to the current location in the buffer. When you encounter a backspace decrement the variable. Whenever you encounter character output write it to your buffer at this location incrementing the variable. You may want to look at alternative data structures, or even some of the containers provided by the C++ standard library to make you life easier and to enable your program to handle larger documents more efficiently.

    Or, you want someone to tell you how to write MS-Word, in which case your query is far too general.

    >Are everyone beginners at this board

    Some of us are. Most know how to ask questions though.

    >vbworld forums, here I come

    Goodbye impatient ****wit.

  9. #9
    Registered User
    Join Date
    Nov 2001
    Posts
    32
    Originally posted by Sorensen
    >aaah I really thought that I was so clear in the above description!!

    Clear as mud. Either you want a very simple explanation -

    Use a variable as the offset to the current location in the buffer. When you encounter a backspace decrement the variable. Whenever you encounter character output write it to your buffer at this location incrementing the variable. You may want to look at alternative data structures, or even some of the containers provided by the C++ standard library to make you life easier and to enable your program to handle larger documents more efficiently.

    Or, you want someone to tell you how to write MS-Word, in which case your query is far too general.

    >Are everyone beginners at this board

    Some of us are. Most know how to ask questions though.

    >vbworld forums, here I come

    Goodbye impatient ****wit.
    --------------------------------------------------------------
    Sorry about that, but I am fairly new to the language...
    and I have no patience..

    *About my description of what I wanted, as I see it, the only way that I could have made it clearer, is if I have printed the code itself... But then I havent had to ask, had I....

    But maybe itīs only seems clear to me!!

  10. #10
    Registered User
    Join Date
    Feb 2002
    Posts
    589
    It can be hard to ask questions so they are clear for everyone. Usally we all are so deep in our own thoughts about our problems so we miss to say things that are obvious for ourself but are missing pieces of information for everyone else.

    As for your problem the third post "switch statment" is what you should build from. Each case can call a function that do what you want with the array. Everything else is basiacly just to read and write to specific locations to the array. Have a variable keep track of where the user is editing and keep on building on the theory you outlined in your question. I think you are closer to the solution then you think. Sometimes when I get stuck I go of and work on some other code for awhile.

  11. #11
    Registered User
    Join Date
    Mar 2002
    Posts
    1,595
    an impatient programmer probably isn't going to amount to much. On a project of any size you are likely to spend more time designing the project and debugging it than you are writing the actual code. Enthusiasm is fine. Impatience will kill.

    I actually thought your initial post was good. The only problem is you posted a rough outline for a project, but no question. If you want support for your project, take the next step. Learn how to read from files into buffers. Learn how to accept user input and to recognize when the user enters backspace. Learn how to insert and delete from arrays. Everything you want to do is doable.

  12. #12
    Registered User
    Join Date
    Nov 2001
    Posts
    32

    Thumbs up Thanx!!

    *********************
    Thanks Barjor and Elad!!
    *********************

  13. #13
    Registered User biosx's Avatar
    Join Date
    Aug 2001
    Posts
    230
    I agree that you stated a project description but no question. And, no, not everyone is a beginner on this board.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Laptop Problem
    By Boomba in forum Tech Board
    Replies: 1
    Last Post: 03-07-2006, 06:24 PM
  2. plz help me with run problem
    By onlinegeek in forum C++ Programming
    Replies: 9
    Last Post: 12-14-2005, 11:46 PM
  3. Replies: 5
    Last Post: 11-07-2005, 11:34 PM
  4. compiling problem! plz help!
    By aaroroge in forum C++ Programming
    Replies: 9
    Last Post: 10-24-2005, 09:57 PM
  5. searching problem
    By DaMenge in forum C Programming
    Replies: 9
    Last Post: 09-12-2005, 01:04 AM