Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 196299
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T16:45:20+00:00 2026-05-11T16:45:20+00:00

I am writing some small program in C–some log in, log out, create account,

  • 0

I am writing some small program in C–some log in, log out, create account, send-message-to-another-account deal–that I can build on and change and innovate and polish up to refine my skills in C.

What I am trying to figure out is how to implement part of the “compose message” option. After you are prompted for the recipient, subject, and body of the message, I want to be able to go back and edit them–without having to re-type the whole thing. So if I chose the “edit message” option it would write out what I had and let me go back and change something.

I’ve done something sort of like this in x86 assembly, or started to do something like this, so I understand basically how this would be implemented at the machine level, but I don’t know how to implement it in C. How do I do this?

Things like the following are baffling me in C:

  • A good way to handle potentially lengthly input
  • How to write out text and allow the user to edit it, without going back beyond a certain point
  • How to control the position of the cursor

Also, if this has been done before, and there exists a library of functions for things like this (even a standard library I don’t know about) please note that I do want to roll my own for the purpose of learning.

I guess the method I have in my head is to read the message body one character at a time, so that I can account for carriage returns and create a multi-line message. But I’m not sure how I would backspace through it. I guess it would be really hard to do this from the command line(?).

If not impossible, to move the cursor back and erase characters which are already out of the input buffer… Would I have to “re-draw the screen” every time? Like can I just take control of the whole console and just read and write keystrokes to certain positions? Or is this too close to the machine? I sort of did it with assembly, but that used 16-bit interrupts, which I’m not allowed to use in C… This is what I wrote in assembly:

(image that used to be here has disappeared)

where the program would convert a byte value to two character codes representing that byte, then jump over to the right column and write the original byte (which showed up as a character), then jump back and write out two more hex numbers, in the next slot… And so on, left to right, top to bottom… It was easy, but I have no idea how I would implement that in C. All I can do is INT 21 style input and output, writing lines to the console which scrolls the window up and so forth.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T16:45:20+00:00Added an answer on May 11, 2026 at 4:45 pm

    There is no way in ANSI C to make a portable line-editor. If you roll your own, you will have to reroll it for every new operating system you want your program to work on.

    If I may make a suggestion, I would use a pre-existing library to do all of that hard, platform-specific dirty work, and with that leg-up, learn how to handle things like arbitrary-length input and such. Then, when your code works (and is good), learn how to do all that dirty work, and take away the library-crutch. That way, you’re not tackling the whole thing – you’re breaking it down into more manageable parts.

    Even this is a bit of an oversimplification. It took me quite a while to learn how to handle arbitrary-length input.

    Also, know that, if you want your code to be portable, removing the library dependency will mean that, if you want to port it, you’ll have to either a) rewrite all that dirty-work code, or b) add the library back in.

    To end this all on a joke, this is your brain with libraries:

    Pigmaei gigantum humeris impositi plusquam ipsi gigantes vident.
    (If I have seen a little further it is by standing on the shoulders of Giants.)
    –Isaac Newton

    This is your brain without libraries:

    If I have not seen as far as others, it is because giants were standing on my shoulders.
    –Hal Abelson

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 130k
  • Answers 130k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer If the older system can actually handle UTF-7 properly, why… May 12, 2026 at 6:04 am
  • Editorial Team
    Editorial Team added an answer One way to do this is to sample the function… May 12, 2026 at 6:04 am
  • Editorial Team
    Editorial Team added an answer Although this code snippet doesn't seem to show where the… May 12, 2026 at 6:04 am

Related Questions

I am writing some small program in C--some log in, log out, create account,
I am writing a small program for my personal use to practice learning C++
I'm writing a small program loader for my language because I gave up on
I am writing a fairly large and complex data analysis program and I have
I have a friend who is finishing up his masters degree in aerospace engineering.

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.