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 7682273
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T18:31:48+00:00 2026-05-31T18:31:48+00:00

I am doing a project in which i am designing a Text Editor application

  • 0

I am doing a project in which i am designing a Text Editor application in Turbo C (Dos). I want to add different menus in my application like File , edit , view etc. I have already designed file and security menu but i want to implement Edit menu which includes functions like Undo , Redo , Cut , Copy , Paste etc. which require me to implement a clipboard. I know there is a way to do this in windows by using the windows clipboard but i dont want to use clipboard provided by windows. I want to implement my own clipboard.

Remember my application is DOS based and windows clipboard will not be available. Even if there is someway of using windows clipboard it is not required. I want to implement my own clipboard.

  • 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-31T18:31:50+00:00Added an answer on May 31, 2026 at 6:31 pm

    Ok, so lets assume your data structure is something like this:

    struct Textview {
        char *text;
        int startRange;
        int endRange;
    };
    

    So, when we add the cut function:

    char clipboard[1024]; // max of 1024 chars in the clipboard.
    
    void cut(struct Textview *textview)
    {
        // first we copy the text out (assuming you have 
        int nCpy = textview->endRange - textView->startRange >= 1024 ? 1023 : textview->endRange - textview->startRange;
        strncpy(clipboard, textview->text + textview->startRange, nCpy);
    
        // next, we remove that section of the text
        memmove(textview->text + textview->startRange, textview->text + textview->endRange, strlen(textview->text + textview->endRange);        
    }
    

    And a copy function:

    void copy(struct Textview *textview)
    {
          int nCpy = textview->endRange - textView->startRange >= 1024 ? 1023 : textview->endRange - textview->startRange;
          strncpy(clipboard, textview->text + textview->startRange, nCpy);
    }
    

    And then the paste function.

    void paste(struct Textview *textview)
    {
         // assuming we have enough space to paste the additional characters in.
         char *cpyText = strdup(textview->text); // if strdup isn't available, use malloc + strcpy.
         int cpyTextLen = strlen(cpyText);
         int clipboardLen = strlen(clipboard);
         memcpy(textview->text + textview->startRange, clipboard, clipboardLen);
    
         memcpy(textview->text + textview->startRange + clipboardLen, cpyText + textview->startRange + 1, cpyTextLen) - textView->startRange);
    
         textview->text[textView->startRange + clipboardLen + cpyTextLen + 1] = '\0';
    
         free(cpyText);
    }
    

    For undo-redo, you need a stack of the changes that were made.

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

Sidebar

Related Questions

I'm doing a project which requires numerical pattern matching. For example i want to
I am doing a project which will finally print a pdf file or doc
Now I'm doing a project which need draw multiple pie charts with text. Can
I am doing a project which is based on storing the employee details, like
I'm doing an AutoLisp project which uses long associative structures to do heavy geometrical
I am doing a project in which I require btree or b+tree data structure.
I am doing a project, for which I need to know all the wikipedia
For this university project I'm doing (for which I've made a couple of posts
Im doing a project with C# winforms. This project is composed by: alt text
I'm doing a project which is similar to the Download Manager. One of the

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.