Learning C: getting Devx and what do I do next? (Solved!)

Issues and / or general discussion relating to Puppy

Moderator: Forum moderators

User avatar
wiak
Posts: 4082
Joined: Tue Dec 03, 2019 6:10 am
Location: Packing - big job
Has thanked: 65 times
Been thanked: 1208 times
Contact:

Re: Learning C: getting Devx and what do I do next?

Post by wiak »

So now that you have the devx (or a suitable environment for learning C installed on your system), the question remains "what do I do next". From some of the answers supplied it can be seen that there are different possible journeys depending on why a person wants to learn C - the purpose:

For example, the vast majority of my own C programming was for Linux system-level programming, such as for developing and optimising the TCP/IP stack and developing new Internet protocols or for overall performance testing of others.

So my own skills with C are not strongly graphic GUI creation oriented (though I have done a little in that area). C is not GTK+ (despite that using C in its library creations) and C is not Qt, which is written in C++, which is basically an object-oriented superset of C. C itself is a very short and precise language and thus 'relatively' easy to learn little language (I learned from K & R book - page by page - very concentrated but very few pages overall in fact compared to so many huge books out there explaining the use of most computer languages).

https://en.wikipedia.org/wiki/The_C_Pro ... g_Language

As that wikipedia article on K&R book states:

[The C Programming Language] written by Brian Kernighan and Dennis Ritchie, the latter of whom originally designed and implemented the language, as well as co-designed the Unix operating system with which development of the language was closely intertwined.

An understanding of C thus also gives the user a more complete understanding of UNIX and thus the operation of many Linux system-level commands and general underlying Linux code structure (pipes, redirection, file handles, stdin, stdout, stderr, and so on), which can also help understand some of the more difficult bash constructs since the shell bash itself works very closely to the underlying C code it is written in.

So once you get the devx, you have the environment for programming, but the issue is certainly what to do next, and that depends what you wish to program, a robot, an InternetOfThings device, some other piece of hardware, a new system utility for Linux (that involved no GUI), or some sort of GUI app/utility? For the latter there are other approaches that are not so difficult, yet often as useful, as using C - such as Python with some widget set or some abstraction such as kivy, which is very powerful and easy to build GUI apps with indeed (and of course there is always yad (and gtkdialog, which is certainly not my recommendation) and similar for simple GUI frontends for underlying bash/shell code and commandline programs.

https://www.tinylinux.info/
DOWNLOAD wd_multi for hundreds of 'distros' at your fingertips: viewtopic.php?p=99154#p99154
Αξίζει να μεταφραστεί;

Sam Hobbs
Posts: 29
Joined: Mon Nov 29, 2021 12:58 am
Location: California, USA
Been thanked: 1 time
Contact:

Re: Learning C: getting Devx and what do I do next?

Post by Sam Hobbs »

wiak wrote: Sun Aug 29, 2021 12:44 am

https://en.wikipedia.org/wiki/The_C_Pro ... g_Language

As that wikipedia article on K&R book states:

[The C Programming Language] written by Brian Kernighan and Dennis Ritchie, the latter of whom originally designed and implemented the language, as well as co-designed the Unix operating system with which development of the language was closely intertwined.

An understanding of C thus also gives the user a more complete understanding of UNIX and thus the operation of many Linux system-level commands

The Unix operating system was designed to be portable among hardware and the C language was designed to be portable among operating systems.

See C and Unix Portability at https://www.bell-labs.com/usr/dmr/www/portpap.html. In IV. THE UNIX PORTABILITY PROJECT it says

refine and extend the C language to make most C programs portable to a wide variety of machines

and later on machines are defined in

A C compiler adaptable to other machines (independently of UNIX)

It also says

Work began in the early months of 1977

The May 6, 2005 ISO/IEC 9899 draft of the C standard has a footnote saying

This International Standard is designed to promote the portability of C programs among a variety of
data-processing systems.

The draft standard says portable 8 times and portability 34 times.

wiak wrote: Sun Aug 29, 2021 12:44 am

general underlying Linux code structure (pipes, redirection, file handles, stdin, stdout, stderr, and so on)

Other operating systems have all that too.

Sam Hobbs
Posts: 29
Joined: Mon Nov 29, 2021 12:58 am
Location: California, USA
Been thanked: 1 time
Contact:

Re: Learning C: getting Devx and what do I do next? (Solved!)

Post by Sam Hobbs »

And I came here attempting to find something describing what is available in Devx for developing console (called terminal in Linux?) programs. I see the program for developing GUI applications. I do not see an answer here but I will create a new question if I do not find answers elsewhere.

User avatar
6502coder
Posts: 90
Joined: Mon Jul 13, 2020 6:21 pm
Location: Western US
Has thanked: 3 times
Been thanked: 22 times

Re: Learning C: getting Devx and what do I do next? (Solved!)

Post by 6502coder »

The confusion between "console" and "terminal" has gotten so messy that I prefer to avoid the whole mess and stick to "command line interface," or CLI.

Those of us who cut our teeth on UNIX remember that the "console" was a dedicated TTY device, usually printing on perforated paper, from which the computer was operated by the high priest. Ordinary users had time-shared terminal devices like the VT100. These days, I doubt that any Linux system has an actual console device, but the term has lingered to refer to the initial CLI that is present upon booting up. Terminals as such of course generally no longer exist either, having given way to "terminal emulators,' which are confusingly still called "terminals." As I said, I'll stick to CLI thank you very much.

Now then, for developing CLI programs, all you need is what you need for any programming language: an editor. I will not get into the equally abysmal mess that is the confusion between "text" editors, "programming" editors, "writing" editors, etc. I knew one professional developer who wrote his C code using MS Word for heavens sake! Suffice to say that Geany is a good choice for writing C as every Puppy has it. You write your C code using your editor, you compile it -- and here a working understanding of how "make" and "makefiles" work is something you should acquire as soon as possible -- then you glare at the compiler errors and you go back to the editor to fix your code. (Tip: when you start using "make", be sure you understand when "tab" characters are REQUIRED in a "makefile" and cannot be replaced with simple space chars. And know how to tell your editor to insert actual "tab" characters and not spaces.)

I don't know what else you were expecting the devx to provide. I know some people just have to have an "IDE" of some kind, but I have written well over 2 million lines of C and nearly all of it was done using nothing more than the compiler, my favorite editor (MicroEMACS), and the standard UNIX/Linux text file tools like awk, grep, etc.

Sam Hobbs
Posts: 29
Joined: Mon Nov 29, 2021 12:58 am
Location: California, USA
Been thanked: 1 time
Contact:

Re: Learning C: getting Devx and what do I do next? (Solved!)

Post by Sam Hobbs »

6502coder wrote: Wed Dec 29, 2021 2:47 am

The confusion between "console" and "terminal" has gotten so messy that I prefer to avoid the whole mess and stick to "command line interface," or CLI.

I think a good definition of a C or C++ console or a terminal application is one that supports the language standard without requiring a library for a UI. And another definition is a text-only UI, but there is at least one UI library that is text-only that insists it is a GUI. I do not know if a Unix/Linux terminal window is capable of graphics or if graphics requires a separate window but in Windows console windows do not support graphics and graphics requires a separate window.

6502coder wrote: Wed Dec 29, 2021 2:47 am

You write your C code using your editor, you compile it -- and here a working understanding of how "make" and "makefiles" work is something you should acquire as soon as possible

I understand. And yes I consider some kind of support of makefiles to be basic to IDEs. I understand that we can do makefiles ourselves.

The make tool is a good example of what I mean. Years ago developers learned that they were doing the same boring things and when the projects grew they realized that it would help to automate the stuff that is simple and repetitive. The fact that it is simple to do is excellent justification for letting the computer do it.

Sure, I am spoiled. When I began learning computers I had to use a keypunch to write programs. Or I had to use a pencil to write programs onto a coding pad so someone else could do the keypunch data entry. And I got only about two chances a day to test my programs. Call me spoiled but I say I have learned the value of letting technology do what it does best. It is not that I am incapable of doing it; it is a matter of priorities.

User avatar
6502coder
Posts: 90
Joined: Mon Jul 13, 2020 6:21 pm
Location: Western US
Has thanked: 3 times
Been thanked: 22 times

Re: Learning C: getting Devx and what do I do next? (Solved!)

Post by 6502coder »

Perhaps it's a matter of semantics. Do you consider "ncurses" to be a UI library?

A Linux terminal emulator window is certainly capable of some some degree of "graphics." For instance "dialog" is used to make what most people I think would consider to be graphical user interfaces. CLI text editors like vi and emacs could be considered to have graphical user interfaces, insofar as they have what used to be called "full screen" editing capabilites, as opposed to a pure text editor like UNIX "ed" was. The "e3" editor is a full screen editor yet it has no dependencies other than libc.

I'm sorry if I have misjudged the extent of your software development experience and/or the scale of the projects you are undertaking. I would have thought that someone who was just starting out in C and was only interested in non-GUI programming would hardly be likely to need sophisticated tools like automated makefile generation. Personally, I would consider a source code version control system to be more important for a large project than automated makefiles.

Years ago developers learned that they were doing the same boring things and when the projects grew they realized that it would help to automate the stuff that is simple and repetitive.

That's essentially what movitated the development of UNIX in the first place. The UNIX guys managed to get a hell of a lot of stuff done on monochrome, character-based displays long before X-Windows came around.

Sam Hobbs
Posts: 29
Joined: Mon Nov 29, 2021 12:58 am
Location: California, USA
Been thanked: 1 time
Contact:

Re: Learning C: getting Devx and what do I do next? (Solved!)

Post by Sam Hobbs »

6502coder wrote: Wed Dec 29, 2021 6:22 am

Perhaps it's a matter of semantics. Do you consider "ncurses" to be a UI library?

A Linux terminal emulator window is certainly capable of some some degree of "graphics."

Note that a UI can be graphical or non-graphical. A GUI by definition uses graphics. ncurses manipulates text, correct?

I consider graphics to be drawing and manipulating pixels.

Note that I am not the person that asked the question. I apologize for the confusion. My point was that the C language was designed from the beginning to enable development of software independent of the environment; in 1972 they said machine and meant that to mean operating system. I mentioned terminal/console programming and said that I will ask in a separate question if I need help.

Post Reply

Return to “Users”