Editable input

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • logicbloke
    New Member
    • Jan 2010
    • 7

    Editable input

    Hello,

    In a modifying function, the user might not change the whole structure's data, so I wanted for example if he hits enter, it just keeps the old data, but scanf("%d",inte ger); doesn't accept a return character and keeps asking.

    Entrer the uid : //user hits enter initial value should be kept
    Enter the username :

    so I wanted to fill in advance the user input, just like the following :

    Entrer the uid : 12 // this value is printed out as an "input" and can be fully/partly erased by the user in other words editable.

    Feel free to ask for additional informations,
    Thanks,
  • johny10151981
    Top Contributor
    • Jan 2010
    • 1059

    #2
    In that case better dont use any scanf function. Cause it must ask until you enter. So you better try something different. Like creating a function that would receive a string then try to convert it to number. in that case you use string. use scanf to get data to the string variable and after that convert it to integer or if the user just press enter you can skip converting(i cant recall what scanf function will do if you press enter without giving any data)

    Or if you have better idea you can share :)

    Best regrads,
    johny

    Comment

    Working...