[PC C] A few beginner questions

Got questions? Got answers? Go here for both.

Moderator: MaxCoderz Staff

Post Reply
User avatar
Timendus
Calc King
Posts: 1729
Joined: Sun 23 Jan, 2005 12:37 am
Location: Netherlands
Contact:

[PC C] A few beginner questions

Post by Timendus »

I've just decided that I should stop abusing PHP scripts for everything I wish to achieve in the field of file manipulation and decided that now is as good a time as any to start learning a bit more about C programming. I've done a bit before for my Operating Systems course, but only a bit.

Anyway, I've got my compiler set up and my first "Hello world" program written (with name recognition, ain't I cool 8)) and tested to work. Now I need to (or would like to) get a few rather complex things to work:

- Parsing a given XML file
- Loading and slightly manipulating images (mostly bitmaps, and I know how to work with bitmaps so I really just need to read the contents of a file)
- Writing to another file

In other words; I need a few good tutorials about C in general and about file manipulation. And I'd appreciate some libraries for XML parsing and image loading. What would you guys recommend that will get me on my way FAST so I can get back to do things that are more relevant to this project? :)

(FYI: I'm working on the intro cinematic for TCOL, and I'm loading and converting lots of bitmaps and stuff to include files with PHP but it's getting too crappy to work with so I want to redo it, and redo it good this time)
http://clap.timendus.com/ - The Calculator Link Alternative Protocol
http://api.timendus.com/ - Make your life easier, leave the coding to the API
http://vera.timendus.com/ - The calc lover's OS
CompWiz
Calc King
Posts: 1950
Joined: Thu 13 Oct, 2005 1:54 pm
Location: UB

Post by CompWiz »

I highly reccomend cplusplus.com for c info. They have a nice tutorial and great info that you can look up on almost all commands. Check it out.

Edit: oh, wait, are you doing c++ or just c? I was talking about c++.
In Memory of the Maxcoderz Trophy Image
CoBB
MCF Legend
Posts: 1601
Joined: Mon 20 Dec, 2004 8:45 am
Location: Budapest, Absurdistan
Contact:

Post by CoBB »

Given this context I'd say you should pick a different task to brush up on C. ;)

Here's a tutorial that seems to be good at first glance:

http://www.le.ac.uk/cc/tutorials/c/

I could only google for libraries too, so I won't recommend any. But writing your own XML parser is also pretty simple if you don't handle errors (which is unnecessary if you work with your own files), since the format is rigid enough. And an excellent task to practice memory handling (at least if you want to parse it into a tree). :P
User avatar
benryves
Maxcoderz Staff
Posts: 3087
Joined: Thu 16 Dec, 2004 10:06 pm
Location: Croydon, England
Contact:

Post by benryves »

Er... why C for any of those?
What would you guys recommend that will get me on my way FAST so I can get back to do things that are more relevant to this project?
The key word being FAST. C# is (loosely) C-style and gives you access to the .NET framework which has extensive classes for XML document parsing, bitmap manipulation (Bitmap here meaning a raster graphic, not exclusively a Windows BMP) and text and binary file reading/writing.

.NET is language agnostic, so with VB it'd be much the same (and I'm sure kv would back me up on this count).
Last edited by benryves on Wed 26 Jul, 2006 9:37 am, edited 1 time in total.
CoBB
MCF Legend
Posts: 1601
Joined: Mon 20 Dec, 2004 8:45 am
Location: Budapest, Absurdistan
Contact:

Post by CoBB »

Exactly, that's why I didn't understand why he'd choose C.
User avatar
kv83
Maxcoderz Staff
Posts: 2735
Joined: Wed 15 Dec, 2004 7:26 pm
Location: The Hague, Netherlands
Contact:

Post by kv83 »

Exactly what I was thinking too, ben. Try C# for those tasks you describe. It works like a charm with xml. It feels as if those two languages were made for each other :P
(and I'm sure kv would back me up on this count)
Jup. VB.NET and C#.NET are almost the same, just a little different syntax (like defining variables). I do like C# a little more, though EM is in VB.NET for example :) It really doesn't matter which you pick up first
Image
User avatar
Timendus
Calc King
Posts: 1729
Joined: Sun 23 Jan, 2005 12:37 am
Location: Netherlands
Contact:

Post by Timendus »

Okay, okay... kv got me convinced to give C# another try on MSN, and I must say I like it more ;) Still, it would've been a good idea to play with C a bit because I think it would've been more educational.

So... I'm back to my extended Hello World console app, watching C# for beginners videos (which make me feel really smart :mrgreen:) trying to get to the lesson about XML parsing... I'll get back to you guys if I need some help but I think I'll be okay for most of this now :) Thanks!
http://clap.timendus.com/ - The Calculator Link Alternative Protocol
http://api.timendus.com/ - Make your life easier, leave the coding to the API
http://vera.timendus.com/ - The calc lover's OS
User avatar
benryves
Maxcoderz Staff
Posts: 3087
Joined: Thu 16 Dec, 2004 10:06 pm
Location: Croydon, England
Contact:

Post by benryves »

Just make sure you're using .NET 2.0/VS 2005, as they added loads of really nifty features (generics are rather useful). :)
Post Reply