Page 1 of 1

[PC C] A few beginner questions

Posted: Wed 26 Jul, 2006 12:11 am
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)

Posted: Wed 26 Jul, 2006 2:25 am
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++.

Posted: Wed 26 Jul, 2006 7:39 am
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

Posted: Wed 26 Jul, 2006 9:19 am
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).

Posted: Wed 26 Jul, 2006 9:30 am
by CoBB
Exactly, that's why I didn't understand why he'd choose C.

Posted: Wed 26 Jul, 2006 10:11 am
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

Posted: Wed 26 Jul, 2006 12:12 pm
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!

Posted: Wed 26 Jul, 2006 12:26 pm
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). :)