Alternatives to standard c input/output

  • Thread starter dE_logics
  • Start date
  • Tags
    Standard
In summary, using command-line and GUI-based I/O libraries like QT and GTK in Linux is more complicated than using stdio.h. There is more work involved, and you need to learn about the API to your graphical toolkit.
  • #1
dE_logics
742
0
I assume we should have commandline and GUI based...like QT and GTK (in linux) right?

So if we want to use these i/o interface, we need to include these QT and GTK libraries (which will be most probably included in the QT/GTK-dev package) instead of stdio.h right?

Or, is it that the alternative is completely different and I'm completely wrong above?

If I'm right, can anyone give me a link to a tutorial teaching how to use QT/GTK/(other interfaces) libraries?...or what package are they contained in?
 
Technology news on Phys.org
  • #2
It's far, far more complicated than that. For one thing, you don't need to worry about event handlers and callbacks when you're working with stdio; if you're using Qt/GTk/etc, you do. You also need to learn about the API to your graphical toolkit, which takes time, effort, and tears.

As an example of this sort of thing, the easiest thing to do is not to consider C/C++ at all but instead to look at Python. Implementing a GUI to a program is much easier in Python than in C/C++, but there's still quite a bit of work involved. For instance, you'd implement the standard Hello, World! app in Python using something like the following.

Code:
#!/usr/bin/env python

print "Hello, World!"


This is much simpler than the corresponding C/C++ version, but it does pretty much the same thing: it prints "Hello, World!" to standard output. Now consider trying to do the same thing with the wxPython toolkit.

Code:
#!/usr/bin/env python

from wx import *

app = wx.PyApp()
frame = wx.Frame(None, wx.ID_ANY, "Hello, World!")
frame.Show(True)
app.MainLoop()

You do much more work here. You have to

  • Import the wxPython module.
  • Create an instance of wx.PyApp in which to hold your graphical application.
  • Create a wx.Frame object for the actual graphical output, and specify its parent widget, its identifier, and its window title.
  • Actually tell the widget to display itself.
  • Hand off control to the wx.PyApp.MainLoop method so as to handle user-generated events.

And that's just to print Hello, World in the title bar. To have it in a text box in the app involves even more work.

The moral of all this is to concentrate on learning the fundamentals of whatever language you're using for as long as possible; you'll have plenty of time to look at graphical toolkits later on.
 
  • #3
At least we don't have paradoxes and REALLY unanswerable question like in physics...


Then what about compiz?...I think that will be tooooo heavy. :rofl:
 

1. What are some examples of alternatives to standard c input/output?

Examples of alternatives to standard c input/output include using libraries such as scanf and printf, using command line arguments, using file input/output functions, using standard input/output redirection, and using interactive input/output methods.

2. Are there any advantages to using alternatives to standard c input/output?

Yes, there are several advantages to using alternatives to standard c input/output. These include increased flexibility, improved error handling, and better performance in certain situations.

3. Can I still use standard c input/output alongside alternatives?

Yes, it is possible to use standard c input/output alongside alternatives. In fact, many developers use a combination of both methods depending on their specific needs.

4. Are there any drawbacks to using alternatives to standard c input/output?

One potential drawback of using alternatives to standard c input/output is that they may not be supported by all compilers or operating systems. Additionally, some alternatives may have a steeper learning curve compared to standard c input/output.

5. How do I determine which alternative to use for my specific project?

The best way to determine which alternative to use for your project is to consider your specific needs and goals. For example, if you need to handle large amounts of data, file input/output functions may be the best option. If you need a more user-friendly interface, interactive input/output methods may be a better choice.

Similar threads

  • Programming and Computer Science
Replies
2
Views
1K
  • Programming and Computer Science
Replies
3
Views
1K
  • Programming and Computer Science
Replies
3
Views
3K
  • Quantum Physics
3
Replies
87
Views
5K
  • Programming and Computer Science
Replies
6
Views
3K
  • Programming and Computer Science
Replies
26
Views
5K
  • Programming and Computer Science
Replies
1
Views
4K
Replies
10
Views
2K
  • Programming and Computer Science
Replies
23
Views
7K
Back
Top