• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 388
  • Last Modified:

Turning control of a RealBasic program over to C++(G++)

Hello. I don't really want to write a plug-in for RealBasic per se. As per prior questions I find the C++ GUI's (especially Qt) extremely difficult. While not GNU I have to give RealBasic credit for writing a GUI interface that is much more intuitive than Qt. Therefore I would like to use RealBasic's GUI to enter data, and then execute C++ programs I have already written. The C++ application is some datamining software I use for my peculiar area of research. All I need to do is store data entry from RealBasic into to a file and then when the C++ program is executed it reads the RealBasic generated "parameters" file and knows how to process the file in question. I was running the C++ application from the console, and entering parameters with a spreadsheet form, but now want to pretty all up with a customized GUI. So the outline is:

Begin RealBasic --> data entry --> RealBasic stores data entry into file "parameters.txt"  --> RealBasic quits and C++ program takes over -->
C++ loads parameters.txt and also File_to_be_mined.txt --> C++ writes processed file.

It is the passing of the baton from RealBasic to G++ that I can't figure out

I use G++ under Linux Fedora 7. I checked VB, but use RealBasic

Please if possible write the exact command(s) I need (a snippet) if such exists.

I appreciate your help in advance

Thanks LD
  • 3
1 Solution
lwdalton3Author Commented:
Actually I have partly answered my question. I guess I would use a shell script of which I know little of how to write. So lets begin with two cpp programs. If we have a program  "parameters.cpp" and another program  "process.cpp"
how would the shell script look to run "parameters.cpp" followed by "process.cpp"
After I see how two .cpp programs are run consecutively maybe I can figure out how to do the same with a basic to a cpp.

Thanks LD
A script would indeed be the easiest way to accomplish that regardless of the programming languages involved. Be sure to check out http://www.freeos.com/guides/lsst/ ("Linux Shell Scripting Tutorial") and http://www.hsrl.rutgers.edu/ug/shell_help.html ("How to write a shell script"). The script itself probably will turn out to be quite simple, the idea would be to

/path/RealBasicProc # execute part 1
/path/parameters # execute part 2
/path/process # execute part 3
echo "Done"

Open in new window

lwdalton3Author Commented:

Using hints about shell I finished answering my own question. RealBasic has a shell class. I built a pushbutton and an edifield, and thats all that is needed for the very basics The folowing code in realbasic will execute a C++ program (C++ program and makefile in same directory as realbasic exec)  The command line results will be displayed in the RealBasic editfield. One doesnt need to have the command line open. So this was much easier for me than dealing with Qt

  dim cmd as string
  dim cmd2 as string
  dim s as new shell
  s = new shell
  #if targetmacos or targetlinux and not(targetmacosclassic)
    cmd2 =" ./dm_toolkit_class"      

#elseif targetwin32                                          
  s.execute cmd                              //runs make
  s.execute cmd2                          // runs object
  if s.errorcode=0 then
    editfield1.text = s.result
    editfield1.text = "error " +str(s.errorcode)
  end if
lwdalton3Author Commented:
Thank you. The shell references helped alot
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now