You are not logged in.

#1 2006-04-16 14:56:00

Jefg60
Member
From: UK
Registered: 2006-01-07
Posts: 100

Whats the best way to go about learning C?

I'm an almost complete noob when it comes to programming. I did write a few simple pascal programs about 10 years ago at school, thats about it.

What I hope to achieve is (hopefully) not that complex, but I'm not sure where to start learning. My reason for wanting to learn is this: I really love MOC (music on console) but I ended up wanting a GUI player which still worked without the mouse. Every one I tried just isnt a patch on MOC, IMO, or just has one or other feature that doesnt work without a mouse. wink So it occurred to me, I have the source code for all these GUI players and the source for MOC, perhaps I can "modify" MOC and create a GUI version, or alternatively write some kind of front end to MOC.

So far, I have had a go with Glade and Anjuta IDE, but my knowledge of C being almost nonexistent is making things tough. I'm probably trying to do it wrong anyway, my thought was to create a GUI in glade and make it call functions from the moc source... :?:

So I need a crash course in C programming with Glade (I think?) and I'm not sure what the best way to proceed is.

Any tips on how best to learn? I ask here because you all seem to be the most knowledgable group I can think of big_smile

Offline

#2 2006-04-17 14:48:25

Bison
Member
From: Jacksonville, FL
Registered: 2006-04-12
Posts: 158
Website

Re: Whats the best way to go about learning C?

For a new programmer, I would look into the book
Programming in C ( i think its called).

And then learn the API with online docs.

Offline

#3 2006-04-18 01:51:43

syamajala
Member
From: here, there, everywhere
Registered: 2005-01-25
Posts: 604
Website

Re: Whats the best way to go about learning C?

I think you meant The C Programming Language. Thats the only c book. i found that things make sense when i read these kinds of books twice. First time just read through it. Second time read through it while setting in front of a computer and trying stuff out as i go along.

Offline

#4 2006-04-19 14:57:04

Bison
Member
From: Jacksonville, FL
Registered: 2006-04-12
Posts: 158
Website

Re: Whats the best way to go about learning C?

Nope, I meant Programming In C (Third Edition).  That's the book I have and its awesome.  I have not read The C Programming Language, but I have heard equally good things about it.

Offline

#5 2006-04-19 17:02:31

syamajala
Member
From: here, there, everywhere
Registered: 2005-01-25
Posts: 604
Website

Re: Whats the best way to go about learning C?

its the only c book ;-p

Offline

#6 2006-04-20 00:50:50

Kopsis
Member
Registered: 2006-01-31
Posts: 15

Re: Whats the best way to go about learning C?

I'm not trying to discourage you, but the idea of Frankensteining all that C source into your own custom GUI music player is likely to cause nothing but hours of frustration. C is a great language for system programming, but for most application software it's far too low level and for most beginners it's far too dangerous (it lets you do bad things that can kill your app in dozens of intersting and extremely hard to debug ways).

What I would suggest is that you first off break the problem in half. Use a client/server approach. The server does all the low-level heavy lifting of decoding/decompressing the music files and sending them to your audio subsystem. Something like Music Player Daemon (MPD) is perfect for the server part and is specifically designed to be controlled by a separate client program.

Then all you have to do is write the GUI client of your dreams. For that I would recommend something like Python plus the GUI library of your choosing (Qt, GTK, wxWidgets, etc. all have nice Python bindings). Python is a far easier beginner language than C and can do much more work with much less code. You'll spend less time mucking around looking for memory leaks and invalid pointer references and more time actually making your GUI do useful work smile Oh, and there just happens to be a Python MPD client library so the task of communicating with the server gets even easier.

Offline

#7 2006-04-22 09:39:24

Jefg60
Member
From: UK
Registered: 2006-01-07
Posts: 100

Re: Whats the best way to go about learning C?

hmmm, thanks for that Kopsis. I started learning python a while back but with no real reason to use it it kinda fell by the wayside. One question though, am I going to end up with a less efficient program? the reason I ask is that I'm running it on a fairly slow machine which has a diskless root. MOC has given me the best performance of any player on it so far, eg when the playlist gets big.

Offline

#8 2006-04-27 03:08:41

Kopsis
Member
Registered: 2006-01-31
Posts: 15

Re: Whats the best way to go about learning C?

Jefg60 wrote:

One question though, am I going to end up with a less efficient program?

I can't really answer that one. I'm told that MPD handles large playlists efficiently, but I've personally never tried it on low end hardware or with really large lists. My "slow" machine is a 1.6GHz Thinkpad with 512MB RAM and my biggest playlist is only about 700 tracks.

Now, if your concern is that Python will result in a less efficient GUI than C, keep in mind that much of the work is being done in the GUI libraries (GTK+ or Qt) and not the application code. Those are the same regardless of the language used for the app. The design of the app will have a much greater impact on performance than the language. Even hand coded assembly language can't overcome the limitations of poorly designed/chosen algorithms and data structures smile

Offline

Board footer

Powered by FluxBB