LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-17-2012, 08:51 PM   #1
Kronus980
Member
 
Registered: Oct 2010
Location: California
Distribution: Ubuntu 12.10 x64
Posts: 41

Rep: Reputation: 1
Novice C Programmer


Hello guys. I've been coding in java for a bit, did pretty well, and moved back to C. I have a good knowledge of stdio (Contents of the stdio header), and basic text I/O, but what's next? I'm so used to java, and the jdk, coming with graphics, sound, etc etc, for me to hone my skills in, but what about C? And which is the best way to develop one's skills via programming? Which are the best kind of examples? And on a side note, where's a good source for binary file reading? Particularly image files.

Last edited by Kronus980; 03-17-2012 at 09:21 PM.
 
Old 03-17-2012, 10:16 PM   #2
flamelord
Member
 
Registered: Jun 2011
Distribution: Arch Linux
Posts: 151

Rep: Reputation: 34
The next step depends on what you want to do exactly. If you you want to do some GUI stuff then you probably want to work with a GUI toolkit such as GTK+. As for dealing with binary files, there is a good chance that there is already a library out there for working with them (i.e. libpng for working with png files). Or if you wanted to work at a lower level, you could read the binary files, a byte at a time, and look up the format of the binary file, and interpret it yourself, it's a lot more work, but you would learn a lot more from it as well. I could be wrong, but I think that GTK+ probably has API for interacting with images as well.
 
Old 03-17-2012, 10:45 PM   #3
graemef
Senior Member
 
Registered: Nov 2005
Location: Hanoi
Distribution: Fedora 13, Ubuntu 10.04
Posts: 2,379

Rep: Reputation: 148Reputation: 148
For image files you could take a peek at ImageMagik
 
Old 03-18-2012, 02:00 AM   #4
Kronus980
Member
 
Registered: Oct 2010
Location: California
Distribution: Ubuntu 12.10 x64
Posts: 41

Original Poster
Rep: Reputation: 1
Quote:
Originally Posted by flamelord View Post
The next step depends on what you want to do exactly. If you you want to do some GUI stuff then you probably want to work with a GUI toolkit such as GTK+. As for dealing with binary files, there is a good chance that there is already a library out there for working with them (i.e. libpng for working with png files). Or if you wanted to work at a lower level, you could read the binary files, a byte at a time, and look up the format of the binary file, and interpret it yourself, it's a lot more work, but you would learn a lot more from it as well. I could be wrong, but I think that GTK+ probably has API for interacting with images as well.
Yeah I actually was thinking about that, but I wanted to get into game development. But as for GUI dev, GTK+ was at the top of my list And I seen a bit of libpng, it's nice, but I want to get as low-level as I could possibly with C. Reading each file, byte at a time. Know any good tutorials for that? Like I want to be able to read a .png from the file with just C code.

Quote:
Originally Posted by graemef
For image files you could take a peek at ImageMagik
I actually was trying to avoid that as much as possible, but I will most definitely will be giving it a look-see. As I am trying to dev on consoles (game consoles) down the line. So I don't want to get in the habit of getting used to these convenient libraries. But as I said, I'll give it a look.
 
Old 03-18-2012, 03:06 AM   #5
flamelord
Member
 
Registered: Jun 2011
Distribution: Arch Linux
Posts: 151

Rep: Reputation: 34
If you want to work with binary files you will probably be working with fread and fwrite (see the man pages). The difficult part is knowing how to handle the particular binary format that you are working with. So, for example if you are working with a png file you have could use the information in http://en.wikipedia.org/wiki/Portabl...hnical_details to break apart the different parts of the file. And then of course, for media files like graphics and audio, you often have to worry about uncompressing/compressing the data as well. And you could look at the source code for existing libraries to see how they do it.

And even if you are developping on game consoles, I would still recommend that you use some kind of library to work with graphics and media files if you can, (although you might statically compile the libraries, I don't know that much about game consoles, and I maybe there are libraries specifically for whatever console you are working with).
 
Old 03-19-2012, 03:16 AM   #6
Kronus980
Member
 
Registered: Oct 2010
Location: California
Distribution: Ubuntu 12.10 x64
Posts: 41

Original Poster
Rep: Reputation: 1
I say I want to stay away from those libraries, such as ImageMagick, as it is not available on any console I know of (Homebrew or official), and I will, I just want to start off reading binary with C alone, firstly with images. And I am aware that wikipedia will be of great help. But does anyone know a good tutorial that show's the loading of a .bmp file?
 
Old 03-19-2012, 03:48 AM   #7
graemef
Senior Member
 
Registered: Nov 2005
Location: Hanoi
Distribution: Fedora 13, Ubuntu 10.04
Posts: 2,379

Rep: Reputation: 148Reputation: 148
BMPs are nice and simple. The last time I did something with them was a long time ago and my startign point was some code from a book which I no longer have and can't recall the title however here is a link that might help.
 
Old 03-19-2012, 11:52 AM   #8
resetreset
Senior Member
 
Registered: Mar 2008
Location: Cyberspace
Distribution: Dynebolic, Ubuntu 10.10
Posts: 1,340

Rep: Reputation: 62
If you want to be a game programmer, I want to take this opportunity to wish you the best

Google "demoscene" sometime, and check out the Wikipedia page, it's something you should be interested in, and once you have, check out www.pouet.net .
 
Old 03-21-2012, 02:58 PM   #9
Kronus980
Member
 
Registered: Oct 2010
Location: California
Distribution: Ubuntu 12.10 x64
Posts: 41

Original Poster
Rep: Reputation: 1
Thanks Will do.
 
Old 03-24-2012, 07:24 PM   #10
jarubyh
Member
 
Registered: Aug 2011
Location: $HOME
Distribution: Slackware, FreeBSD, Debian
Posts: 50

Rep: Reputation: 1
Quote:
Originally Posted by Kronus980 View Post
And which is the best way to develop one's skills via programming?
You just answered it. Via programming. The best way to get better at any language is to spend time reading and writing that language.
To be a little more helpful, here's something I like doing.
Find a small project (or large, depending on how much time you have) on SourceForge in C, read through and understand the source code. Then find what the author did wrong, correct his|her mistakes, and maybe add some features recommended in the TODO file. Be sure to send your results to them if you're pleased with it.
Good luck and happy hacking.
 
Old 03-24-2012, 10:18 PM   #11
firstfire
Member
 
Registered: Mar 2006
Location: Ekaterinburg, Russia
Distribution: Debian, Ubuntu
Posts: 709

Rep: Reputation: 428Reputation: 428Reputation: 428Reputation: 428Reputation: 428
Hi.

Some time ago I wrote a program to load and save BMP images, which you can find here. It supports only basic BMP files, like 8 bits per pixel and no compression, but it is something you can play with. AFAIK using structures is an ubiquitous way to read/write structured binary data, and it is the only trick you should learn to do it yourself easily.

Hope that helps.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
I am a programmer(Student). How can i help the Linux community as a Programmer? mgsurya Linux - Newbie 11 07-21-2010 03:56 AM
Novice Korn Shell WantAbe Programmer metallica1973 Programming 6 01-14-2008 06:25 AM
Programmer to Programmer ( Long Story Of A GUI ) mdoubledragon Programming 1 10-13-2005 05:41 PM
Novice C++ Programmer looking for book suggestions. bokavitch Programming 6 01-22-2005 05:08 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:48 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration