The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
 All Forums
 Origin Forum for Programming
 Forum for Origin C
 Output redirection

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
rikseventyseven Posted - 09/09/2009 : 08:26:48 AM
Dear Developers,

I'm developing an analysis tool for my business. The piece of code that I wrote up to know prints results in the command window since I run the program from there.

Now I have two questions:

1- How can I create a menu item (for example in the Analysis Menu) so that I can run the program with a simple click.

2- Alternatively, how can I avoid compiling the program every time that I open an Origin session and run the program from the command window?

3- When the program is run from a menu item, the output is not shown in the command window anymore... Any suggestions on how can I display the results to the user in a smarter way? Is it possible to redirect the program "printf" output to command window?

Thanks a lot

Origin Ver. 8 and Service Release SR5 (Select Help-->About Origin):
Operating System: WinXP

-------------------------------
"Stay hungry, stay foolish."
1   L A T E S T    R E P L I E S    (Newest First)
rlewis Posted - 09/09/2009 : 12:04:09 PM
The following is a code snippet from one of my utility functions. It illustrates redirection of output stored in a atring array " " to either the script window, a notes window or to a file.
Hope this helps ...


.....
			switch (ControlID)
			{
				case IDC_RBN_Script_Window:
					double dVal=LabTalk.type.redirection;
					LT_execute("type -a    ");
					LT_execute("type.redirection=1");
					for(int i=0;i<szOutPut.GetSize();i++)
					{
						strLine=szOutPut[i];
						out_str(strLine);
					}
					LabTalk.type.redirection=dVal;
					strTemp="Results Written to Script Window";
					SetDataDisplayText(strTemp);
				break;
				case IDC_RBN_NOTEPAGE:
					if(OutNote.IsValid()==false)
					{
						if(OutNote.CreateVisible(false)==false)
						{
							SetDataDisplayText("NotePageCreation Error ... Data Not Saved");
							return (false);
						}
					}
					int numLines=szOutPut.GetSize();
					for(i=0;i<numLines;i++)
					{
						OutNote.AddLine(szOutPut[i]);
					}
					strTemp="Results Written to NotePage:"+OutNote.GetName();
					SetDataDisplayText(strTemp);
				break;
				case IDC_RBN_FILE:
					string strPath;
					StringArray saFiletypes;
					saFiletypes.SetSize(1);
					saFiletypes[0]="[ASCII TEXT (*.TXT)] *.txt";
					string strFilePath = GetSaveAsBox( saFiletypes );
					if(strFilePath.IsEmpty()==false)
					{
						stdioFile TextFile;
						if (TextFile.Open(strFilePath, file::modeCreate | file::modeWrite)==true)
						{
							for(int i=0;i<szOutPut.GetSize();i++)
							{
								strLine=szOutPut[i];
								TextFile.WriteString(strLine);
							}
							TextFile.Close();
							strTemp="Results Written to File: "+GetFileName(strFilePath);
							SetDataDisplayText(strTemp);
						}
					}
				break;
			}
...

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000