Thread: Possible to edit a Char Array copying to keyboard input ?

  1. #1
    Registered User
    Join Date
    Nov 2011
    Posts
    10

    Possible to edit a Char Array copying to keyboard input ?

    Hi there guys, I have a question for you, is it possible to the the following in C?
    I mean:

    In the code I would have something like


    char example[] = "Single"

    then do edit this string, I would copy to input of scanf,
    and then i could just use backspace to delete the last char 'e',
    then I would press enter, and scanf would store the new example string
    on the same pointer example..

    Possible in C ?
    Thanks alot guys!

  2. #2
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    No. You'll have to write your own code to edit the string.

    In the end it will probably be easier to just ask your user to re-enter it.

  3. #3
    Registered User
    Join Date
    Nov 2011
    Posts
    10
    Thanks for your reply mate.
    But thats what I want, the user should have a option to edit that string, with scanf, you see?
    And I know how to do it, I was just asking if is possible to copy the string that he is gonna to edit, and put it on scanf input, I dont know if you understood :c
    Thanks alot in advance.

  4. #4
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by DarkLink View Post
    Thanks for your reply mate.
    But thats what I want, the user should have a option to edit that string, with scanf, you see?
    And I know how to do it, I was just asking if is possible to copy the string that he is gonna to edit, and put it on scanf input, I dont know if you understood :c
    Thanks alot in advance.
    I understood...
    You want to stuff it back into the input buffer and let the guy edit it with scanf()...
    That's not gonna happen.

    As I said... you're going to have to write your own code for that.

  5. #5
    Registered User
    Join Date
    Nov 2011
    Posts
    10
    Okay so, I would need to do it by scratch I guess?
    Thanks mate.

  6. #6
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by DarkLink View Post
    Okay so, I would need to do it by scratch I guess?
    Thanks mate.
    Yep... you're going to have to write your own input routine from scratch...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. need help in copying unsigned char array to bit array
    By lovesunset21 in forum C Programming
    Replies: 8
    Last Post: 10-29-2010, 07:23 AM
  2. Getting keyboard input and put into array and print
    By Rob123 in forum C Programming
    Replies: 0
    Last Post: 04-25-2009, 08:36 AM
  3. Copying an INT into a Char array?
    By Wiretron in forum C Programming
    Replies: 4
    Last Post: 08-27-2006, 01:06 AM
  4. Problem Copying char array
    By NullStyle in forum C++ Programming
    Replies: 2
    Last Post: 03-14-2004, 08:06 AM
  5. I need help disabling Keyboard and Mouse input on Edit controls
    By Templario in forum Windows Programming
    Replies: 4
    Last Post: 01-07-2003, 12:59 AM