I've never used Code Builder to write an Origin C program. Is there a simple example of how to do this?

     

I've never used Code Builder to write an Origin C program. Is there a simple example of how to do this?

  1. Click the Code Builder button Code Builder Button on Origin's Standard toolbar.
  2. Click the New button New Button in Code Builder on Code Builder's Standard toolbar.
  3. Select C File from the list box.
  4. Type MyFile in the File Name text box.
  5. Select the \OriginC subfolder if it is not currently selected (this should be the default folder).
  6. Click OK to close the dialog box and open the new file in Code Builder's multiple document interface (MDI).
  7. Type the following Origin C code beneath the line that reads // start your functions here.

    void test()
    {
         printf("hello world\n");
    }

  8. Click the Build button Build Button in Code Builder on Code Builder's Standard toolbar to compile the MyFile.c source file and to link the Stdio.h header file. The Output window should display:

    compiling...
    MyFile.C
    Linking...
    Done!


  9. To test this function in Code Builder, click in the upper pane of the LabTalk Console located in the bottom right corner of Code Builder. (This is the default location after installing Origin 7. If the LabTalk Console isn't open or you are not sure which window it is, toggle it on and off by selecting View:LabTalk Console in Code Builder.)
  10. Type the following LabTalk function call in the LabTalk Console and then press ENTER:

    test

    The phrase, "hello world", displays in the lower pane of the LabTalk Console (as seen below).

    Testing 'test' function in Code Builder's LabTalk Console

  11. Now make Origin the active application.
  12. Select Window:Script window to open the Script window if it is not already open.
  13. Type the following LabTalk function call in the Script window and then press ENTER:

    test

    The phrase, "hello world", displays in the next line of the Script window.


Keywords: 
ID Number: 777
Item Category: Programming Tip
Origin Version: 7.0
Database Information Type: Origin C Code
Number of Times Accessed: 4950
Creation Date: 3/1/2002 12:00:00 AM
Last Modified: 3/1/2002 12:00:00 AM

 

Copyright © 2012 OriginLab Corporation. All rights reserved.
20+ years serving the scientific and engineering community