OESF | ELSI | pdaXrom | OpenZaurus | Zaurus Themes | Community Links | Ibiblio

IPB

Welcome Guest ( Log In | Register )

> C++ Question
Capn_Fish
post May 1 2007, 05:00 PM
Post #1





Group: Members
Posts: 2,350
Joined: 30-July 06
Member No.: 10,575



I'm making a program for the Z that I need to take a variable and use it as part of a "system (xxxx)" command (or some other command to have the program call another command with args). How do I do that? Sorry if a) this is really obvious or cool.gif this question doesn't make sense. I have very little C++ knowledge, but am trying to learn.

Links to a solution would also be appreciated.

Thanks in advance.
Go to the top of the page
 
+Quote Post
2 Pages V   1 2 >  
Start new topic
Replies (1 - 14)
freizugheit
post May 1 2007, 05:56 PM
Post #2





Group: Members
Posts: 409
Joined: 7-November 03
Member No.: 811



http://www.cprogramming.com/tips/showTip.p...count=30&page=1
Go to the top of the page
 
+Quote Post
Meanie
post May 1 2007, 06:19 PM
Post #3





Group: Members
Posts: 2,808
Joined: 21-March 05
From: Sydney, Australia
Member No.: 6,686



QUOTE(Capn_Fish @ May 2 2007, 11:00 AM)
I'm making a program for the Z that I need to take a variable and use it as part of a "system (xxxx)" command (or some other command to have the program call another command with args). How do I do that? Sorry if a) this is really obvious or cool.gif this question doesn't make sense. I have very little C++ knowledge, but am trying to learn.

Links to a solution would also be appreciated.

Thanks in advance.
*


sprintf is your friend smile.gif
Go to the top of the page
 
+Quote Post
Capn_Fish
post May 1 2007, 06:31 PM
Post #4





Group: Members
Posts: 2,350
Joined: 30-July 06
Member No.: 10,575



OK, I got everything sorted out (for the moment).

Thanks for the response.
Go to the top of the page
 
+Quote Post
Capn_Fish
post May 10 2007, 02:17 PM
Post #5





Group: Members
Posts: 2,350
Joined: 30-July 06
Member No.: 10,575



New question: Is jumping in WAY over my head and trying to figure out GUI programming with GTKmm with very little C++ knowledge not recommended (for reasons other than the frustration factor)?
Go to the top of the page
 
+Quote Post
Meanie
post May 10 2007, 04:15 PM
Post #6





Group: Members
Posts: 2,808
Joined: 21-March 05
From: Sydney, Australia
Member No.: 6,686



QUOTE(Capn_Fish @ May 11 2007, 08:17 AM)
New question: Is jumping in WAY over my head and trying to figure out GUI programming with GTKmm with very little C++ knowledge not recommended (for reasons other than the frustration factor)?
*


i'd recommend trying out the qt3 widgets first. took me 3 days to learn qt3 api and write pdaXcfg. i did all this natively on the z so compilation and debugging was much slower. you can actually install qt3 on a pc, compile and debug your app on the pc and when it all looks ok, recompile on the zaurus. there also is qt designer, a gui to create qt3 guis which also works on either pc or zaurus... gtkmm is a bit harder to learn...
Go to the top of the page
 
+Quote Post
Capn_Fish
post May 10 2007, 05:35 PM
Post #7





Group: Members
Posts: 2,350
Joined: 30-July 06
Member No.: 10,575



QUOTE(Meanie @ May 10 2007, 07:15 PM)
QUOTE(Capn_Fish @ May 11 2007, 08:17 AM)
New question: Is jumping in WAY over my head and trying to figure out GUI programming with GTKmm with very little C++ knowledge not recommended (for reasons other than the frustration factor)?
*


i'd recommend trying out the qt3 widgets first. took me 3 days to learn qt3 api and write pdaXcfg. i did all this natively on the z so compilation and debugging was much slower. you can actually install qt3 on a pc, compile and debug your app on the pc and when it all looks ok, recompile on the zaurus. there also is qt designer, a gui to create qt3 guis which also works on either pc or zaurus... gtkmm is a bit harder to learn...
*


What about FLTK?

And I'd assume it'd take me much longer than 3 days if that's how long it took you, as I don't have the background you do wink.gif
Go to the top of the page
 
+Quote Post
pgas
post May 10 2007, 09:54 PM
Post #8





Group: Members
Posts: 1,099
Joined: 17-December 03
From: Athens, Greece
Member No.: 1,210



Depending on you background, you might want to try an easier
language first, say python, ruby....

C++ is probably the most complicated language out there (even if qt makes things easier, and probably gtkmm also).

Don't worry about performances, even the Zaurus is perfectly able to run python applications, and if your application is good or is something people are missing, they will use it anyway.
Go to the top of the page
 
+Quote Post
Meanie
post May 10 2007, 10:19 PM
Post #9





Group: Members
Posts: 2,808
Joined: 21-March 05
From: Sydney, Australia
Member No.: 6,686



QUOTE(pgas @ May 11 2007, 03:54 PM)
Depending on you background, you might want to try an easier
language first, say python, ruby....

C++ is probably the most complicated language out there (even if qt makes things easier, and probably gtkmm also).

Don't worry about performances, even the Zaurus is perfectly able to run python applications, and if your application is good or is something people are missing, they will use it anyway.
*


yeah. python, perl. they all run reasonably fast on the Z, so use the easiest one. python is already pre-installed on pdaXrom since the config tools use it so less stuff needs to be installed in order to run your apps, whereas if you write things in fltk or something else, you will need to install extra libs.

the main reason I choose to learn QT3 instead of python is the load speed. Since qt3 is just additional apis for c++, they are compiled binaries and qt3 libs already exist in pdaXrom (Package Manager and PPP tools for example are QT3) so nothing extra needs to be installed. python and perl are interpretors, you need to have those installed and each app written in those languages requires the interpretor loaded before it loads the app, so essentially more loading time and memory used. since qt3 is a compiled shared library, ie, .so, it only needs to be loaded once and can be shared amongst multiple qt apps.
hence if you want your apps to load very fast, use GTK+ ( C ), not gtkmm (C++) because C is slightly faster than C++ and gtk+ is already installed and loaded by most X apps. qt3 also loads pretty fast, but may be unloaded if no qt3 apps have been used for a while and because the ratio of gtk+ apps is much higher than qt3 apps, chances are the gtk+ libraries are never unloaded and always there...
perl and python apps which dont use gui are also quite fast to load, however, in order to use the GUI, those interpretors need to load a bridge, ie python gtk bindings which is pygtk.

there is not much difference in execution time for the binaries/scripts written in those languages, but the loading time of the interpretors/extra libraries adds additional time for the application to start hence, the perceived speed of the application is slower.

so i chose QT3 because it uses C++ which is Object Oriented instead of procedural like in C, and it loads faster because it is supported by a mutli-threaded shared libraries and already pre-installed on pdaXrom (qt-mt.so). also, the QT3 widget are quite easy to use and make it much easier than standard C/C++ or GTK+
Go to the top of the page
 
+Quote Post
pgas
post May 11 2007, 12:21 AM
Post #10





Group: Members
Posts: 1,099
Joined: 17-December 03
From: Athens, Greece
Member No.: 1,210



I wonder if pyqt and python + gtk-server ( http://www.gtk-server.org/ )
suffer from the same startup overhead
Go to the top of the page
 
+Quote Post
Capn_Fish
post May 11 2007, 03:51 AM
Post #11





Group: Members
Posts: 2,350
Joined: 30-July 06
Member No.: 10,575



Nah, I like C++, and I'll look into QT3.

Thanks.
Go to the top of the page
 
+Quote Post
Capn_Fish
post May 15 2007, 09:51 AM
Post #12





Group: Members
Posts: 2,350
Joined: 30-July 06
Member No.: 10,575



You need -devel libs to compile QT3 on the Z, no? Do these exist, or should I do the dev work on my larger computer?

Thanks.

EDIT: I'm going to put my GUI development on hold until I solidify my C++ base. Thanks for the help, and I'll probably need more in the future.

As a side note, FLTK looks pretty good...
Go to the top of the page
 
+Quote Post
Capn_Fish
post Jun 8 2007, 05:13 PM
Post #13





Group: Members
Posts: 2,350
Joined: 30-July 06
Member No.: 10,575



Is there any way to only use one string-like variable (char[xyz] or string) in my code? Some things complain if I use a char[xyz], but not a string, others work the opposite way, and it would be easier to just use one type instead of converting back and forth.

Thanks.
Go to the top of the page
 
+Quote Post
Meanie
post Jun 8 2007, 06:50 PM
Post #14





Group: Members
Posts: 2,808
Joined: 21-March 05
From: Sydney, Australia
Member No.: 6,686



QUOTE(Capn_Fish @ Jun 9 2007, 11:13 AM)
Is there any way to only use one string-like variable (char[xyz] or string) in my code? Some things complain if I use a char[xyz], but not a string, others work the opposite way, and it would be easier to just use one type instead of converting back and forth.

Thanks.
*



sounds like QString is what you want smile.gif
Go to the top of the page
 
+Quote Post
Capn_Fish
post Jun 8 2007, 06:57 PM
Post #15





Group: Members
Posts: 2,350
Joined: 30-July 06
Member No.: 10,575



QUOTE(Meanie @ Jun 8 2007, 09:50 PM)
QUOTE(Capn_Fish @ Jun 9 2007, 11:13 AM)
Is there any way to only use one string-like variable (char[xyz] or string) in my code? Some things complain if I use a char[xyz], but not a string, others work the opposite way, and it would be easier to just use one type instead of converting back and forth.

Thanks.
*



sounds like QString is what you want smile.gif
*


I'm not using QT. Is that an issue?

Is it possible to just use either strings or character arrays?
Go to the top of the page
 
+Quote Post

2 Pages V   1 2 >
Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 31st October 2014 - 01:32 PM