Re: call C application
Re: call C application
- Subject: Re: call C application
- From: Mai Bui <email@hidden>
- Date: Thu, 27 Apr 2006 16:43:34 -0700
Hi John,
Yes, this app will have 2 portions: one app has GUI and another one
is unix app (command line).
1. Unix app: Since my "AcquireDataApp" is command line app, it can
run on Unix or Mac to acquire data (it's running now on the ship),
all data are save in the file, and we analyze it by matlab, so not
real time (for now).
2. So the main part is done. My next step is somehow to create a GUI
to get input from user, after we have data from "AcquireDataApp",
this app will plot them. That why I think about using cocoa app to
perform these tasks.
To create GUI and window to plot data, I think it takes me more time
to implement in C (unix lib) than use cocoa (?)
But I don't know my way is reliable and possible to make it done or not.
Because our next research trip will coming soon, I do not have much
time, so I do this way. Later on, I will implement everything with
cocoa app. That's my plan.
Thanks for concern and ask question.
Again, thanks for everyone interest in my design.
Mai.
On Apr 27, 2006, at 4:14 PM, John Stiles wrote:
Trying to break this into two portions—a GUI half and a command
line half—seems like extra work to me, and obviously the results
are going to be substandard. What led you to try this approach? If
you're going to make a GUI app, why can't that contain all of the
logic?
On Apr 27, 2006, at 4:10 PM, Mai Bui wrote:
Thanks J.
On Apr 27, 2006, at 3:32 PM, Jordan Krushen wrote:
On 4/27/06, Mai Bui <email@hidden> wrote:
- and press "STOP" button, it send 'q' character to the running
application to stop that application and then quit its self (the
cocoa application).
When you say "send 'q' character", do you mean a 'q' keystroke
(like a
curses app), or text fed to its stdin? If the former, I don't think
NSTask will do the trick. I'm sure others can give advice on how to
handle terminal-manipulation from Cocoa, but I wouldn't expect
anything easy..
Yes, because my current application (let's say "AcquireDataApp")
has multiple thread. There is one thread look forward to get input
from the scientist (user). If it get 'q' keystroke from the user,
it will close all threads and terminate application.
I think about using cocoa application to control this
"AcquireDataApp" because it has GUI dev, from UI:
1. This cocoa app will take input from the user.
2. Then, fetch to "AcquireDataApp" to initialize all our sensors
(for now, "AcquireDataApp" get all these conf from "setup" file).
3. Then, once we have data from "AcquiredDataApp", the cocoa
application will plot those data we get (in real time).
4. Anytime, if scientist want to acquire data, they can press
"STOP" button, the cocoa app will fetch 'q' character to my app.
To me, it seems not to hard to implement it. But, when I touch
cocoa, it's not simple as I thought. I don't know that my design
is possible to do it or not since I could not find a way to
communicate back and fort between one app has GUI to my C app.
Thanks for anyone spend time to share my design.
Thanks again for any idea and knowledge from all of you.
Mai.
Yes, I tried to use NSTask, it seems to work. (it can launch my C
app, not stop though - I will work on it!).
See -[NSTask terminate].
But, I have another question: In my cocoa app I have a window to
display out put. How can I make "printf()" in my C app into this
display window?
Reading from the pipe connected to your C app's stdout will provide
you with its output. Again, see the NSTask docs for details:
http://developer.apple.com/documentation/Cocoa/Conceptual/
OperatingSystem/index.html
J.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40blizzard.com
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden