Lawrence Technological University
College of Arts and Science
Department of Mathematics and Computer Sciences

Introduction to C, MCS 1142

Syllabus | Handouts | Assignments | Lecture Notes

Using The Windows Clipboard

Programs are written in plain text files. The output from command line programs, like we are writing in this course, is also plain text. Frequently you need to copy those bits of plain text. Perhaps you would want to use part of one program in another program; or, you are going to turn in a programming assignment. Certainly, just retyping the text is one way to proceed. Let us review three other ways to copy and paste plain text using the Windows Clipboard. The Windows Clipboard can only hold one piece of text at a time and it is not visible on the desktop, but it is still a very useful temporary holding place that is accessed through the "Edit" menu of any Windows program. Note that Edit, the MS-DOS command line editor, is not a Windows program and its edit buffer is not the Windows Clipboard!

  1. If the text is displayed in a window with a menu bar at the top and there is an "Edit" sub menu, copy the text using the "Edit" menu. First highlight the text you want to copy by dragging with the mouse. Then copy the text to the Windows Clipboard clicking:
    "Edit | Copy" on the menu bar.
  2. If the text is in a MS-DOS command line window, there is no menu bar at the top. The "Edit" sub menu is found under the control menu, that is, by clicking on the icon at the upper left corner of the window. Highlighting is done by first clicking:
    "Edit | Mark" and then dragging the mouse over the area of text you want to copy. Copying the highlighted text to the Windows Clipboard can then be done similarly clicking:
    "Edit | Copy".
  3. If the output from your program is so lengthy that it scrolls off the top of the MS-DOS command line window, you may not be able to highlight the part you want by dragging with the mouse since this window does not scroll. In this case you need to create a temporary text file to transfer your text into a Windows editor program (like Notepad) that does have a menu bar. Let us say you have written a program that lists each student in our class and their special interests on a separate line. The program file is called classint.c and the compiled, executable file is called classint.exe, and both files are in the folder or directory c:\mcs1142. In an MS-DOS command prompt window begin by:
    C:\> cd \mcs1142
    C:\mcs1142> copy classint.c temp.txt
    C:\mcs1142> classint >> temp.txt
    (the >> means add the output of the program classint to the end of temp.txt)
    Next, start Notepad and Open temp.txt into Notepad. Then you can proceed to copy text to the Windows Clipboard as in case 1.
Whether you have copied the text with method 1, 2 or 3, the text is now in the Windows Clipboard. Using:
"Edit | Paste" from any window's menu bar, you can put a copy of the clipboard text into any place in the window where you could type. The keyboard shortcut for "Edit | Paste" is usually CTRL-V, but may vary. For example, in TeraTerm Pro it is ALT-V.

Revised January 4, 2003