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 10-17-2005, 08:51 PM   #1
Mercurius
Member
 
Registered: Jul 2005
Distribution: Slackware 11, Solaris 10
Posts: 143

Rep: Reputation: 15
Programming in C Tutorial


Hi guys, i've been skipping on and off from books about C Programming. I have K&R but they thins very very algorithmic, to much algorithmic for me. I have a hacker's guide to C programming written by lovepump but it's awfully incomplete. I really want to learn C, but the problem is I cant take any courses since nothing is available in my area. Any suggestions? All say K&R but they are very very algorithmic, has anyone noticed that?

P.S. What functions should I use to copy a file from my hdd and then rename it? Like a backup program that would take a vimrc and would copy it to a vimrc.back...
 
Old 10-17-2005, 09:58 PM   #2
cyb0rg777
Member
 
Registered: Dec 2004
Location: ~
Distribution: Debian
Posts: 143
Blog Entries: 8

Rep: Reputation: 15
hello ,I am a newbie myself but I will try to help.

I like Herbert Shildt C the complete reference or C++ the complete reference.
just keep learning and practicing.
for renameing files I'm not sure what to use ,try google
you could just use a bash script or something.
 
Old 10-18-2005, 01:11 AM   #4
ludwig
Member
 
Registered: Jun 2002
Location: Orange County, CA
Distribution: Debian (squeeze), kernel 2.6.30-2-amd64
Posts: 32

Rep: Reputation: 15
My first langauge was C, and I taught myself the language using Stephen G. Kochan's book, "Programming in C" . However, I think that's since gone out of print and has now been updated to "Programming in ANSI C" (http://www.amazon.com/gp/product/067...torialmania-20). This book was a godsend for me -- my only background was in the areas of classical piano and French, and I did ALL the exercises (okay, maybe one or two slipped by). Kochan explains things in a very concise, complete, plain-English manner, without being overly technical. (Much to my surprise, I ended up getting a master's in CS and worked at Symantec for four years as a developer. However, I have since then awoken from the narcotic spell of Windoze, and am now completely rejuvenated by linux!)
 
Old 10-18-2005, 04:00 AM   #5
charliew
LQ Newbie
 
Registered: Apr 2004
Location: Lincoln, UK
Distribution: VectorLinux 5.1 Deluxe
Posts: 4

Rep: Reputation: 0
I found the book from O'Reilly "Practical C Programming, Third Edition" an excellent book. Concise and easy to follow explanations with loads of examples. I too have also used Schildt in the past but now prefer the O'Reilly series. Hope this helps
 
Old 10-18-2005, 04:24 AM   #6
coldAndUgly
Member
 
Registered: Dec 2003
Location: New Zealand
Distribution: Slackware 10.2
Posts: 36

Rep: Reputation: 15
The C Book is an excellent resource for learning how to program in C.
 
Old 10-18-2005, 07:03 AM   #7
sys-fire
LQ Newbie
 
Registered: Nov 2003
Location: USA
Distribution: Debian and Slackware
Posts: 17

Rep: Reputation: 0
C course

If you are looking for a C tutorial, you might be interested in about.com. They offer some free tutorials on C/C++ programming. Check it out. Hope this is what you are looking for.

 
Old 10-18-2005, 10:18 AM   #8
Mercurius
Member
 
Registered: Jul 2005
Distribution: Slackware 11, Solaris 10
Posts: 143

Original Poster
Rep: Reputation: 15
The C Book is full of errors sadly. I had to correct a few programs so it would compile.

How do I use the gdb in order to watch line by line of what happens in the program? And I would also like to see it in asm. Is there a way?

Last edited by Mercurius; 10-18-2005 at 10:48 AM.
 
Old 10-18-2005, 11:53 AM   #9
jorge.vargas
LQ Newbie
 
Registered: Jul 2004
Distribution: Slackware
Posts: 3

Rep: Reputation: 0
You should know that each language has a purpose, for example to do a backupfile you will probably use a scripting language since C is too complicated for that, you should really use shell or perl or python. For example this is a little python funtion a made for that. it will create N backups, instead of overwritting the last backup.

Code:
import shutil
			
def backUp(fileName):
	'''busca archivos `fileName`.bak* hasta que encuentre uno no existente y copia el archivo'''
	cont=0
	while os.path.exists(fileName + '.bak' + str(cont)):
			cont = cont + 1
	shutil.copyfile(fileName,fileName + '.bak' + str(cont))
	print "Creating " + fileName + '.bak' + str(cont) + "..."
if all you need is to make a backup then the shutil.copyfile line is all you need and a main function. You can even just do it on bash with "cp"

Anyway in C, pure C, you will need to read the file pointer, create a second file pointer, copy everything in it and to the other file then close both. here is a link to some funtions. http://gd.tuwien.ac.at/languages/c/p...rown/c_075.htm

And in C it it's cross platform that's why my script is in python

hope that help.
 
Old 10-18-2005, 12:12 PM   #10
Orkie
Member
 
Registered: Mar 2005
Distribution: Breezy Badger
Posts: 248

Rep: Reputation: 30
Quote:
Originally posted by cyb0rg777
I like Herbert Shildt C the complete reference or C++ the complete reference.
I can't comment on those since I've never read them but his 'C++ A Beginner's Guide' (ISBN: 0-07-219467-7 McGraw-Hill/Osborne) is quite good (it could probably take somebody from no C to C++ straight away).
 
Old 10-18-2005, 05:24 PM   #11
geletine
Member
 
Registered: Apr 2005
Distribution: Slackware
Posts: 213
Blog Entries: 2

Rep: Reputation: 30
funny enough i am using K&R, i am on 1.9 character arrays , ive done some of the excises in the book like reversing the order of the temperture chart.
i am hopeing its just a matter of practise with experimentation, looking at loads of source of programs that interest you.

To program well in c takes years of learning
 
Old 10-18-2005, 10:44 PM   #12
primo
Member
 
Registered: Jun 2005
Posts: 542

Rep: Reputation: 34
Quote:
Originally posted by geletine
To program well in c takes years of learning
To program well may take time, but C isn't really a hard language to learn.

Deitel/Deitel C/C++ is a very good book. It's plenty of exercises.
 
Old 10-19-2005, 12:06 AM   #13
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
I can recommend this http://www.amazon.com/exec/obidos/tg...36739?v=glance
for learning C.
Plenty of fully explained examples. 4 1/2 stars avg over 54 reviews...
 
Old 10-19-2005, 02:41 AM   #14
ignasibuch
LQ Newbie
 
Registered: Jul 2005
Posts: 1

Rep: Reputation: 0
O'Reilly e-books

I just downloaded a package of O'Reilly's ebooks by bittorrent. There are a couple about C programming. I'm also interested in getting to it and Perl too.
Can get the .torrent here
 
Old 10-19-2005, 08:07 AM   #15
geletine
Member
 
Registered: Apr 2005
Distribution: Slackware
Posts: 213
Blog Entries: 2

Rep: Reputation: 30
"To program well may take time, but C isn't really a hard language to learn. "

sorry, i should of meant to programme in c something ie, kernal, computer game , fily systems etc..

From wikipedia about Linus Torvalds

"His interest in computers began with a Commodore VIC-20. After the VIC-20 he purchased a Sinclair QL which he modified extensively, especially its operating system. He programmed an assembler and a text editor for the QL, as well as a few games. "

I can imagine this was done over a few years, thats what i am really getting at when i mean its hard to program in c.


Minix has been mentioned as a influence to him...
 
  


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
Searching for a tutorial/book on socket programming koodoo Linux - Networking 6 06-07-2005 01:48 PM
Best python tutorial for programming games. r3dhatter Programming 9 05-17-2004 04:43 AM
looking for X programming tutorial (C or C++) qwijibow Programming 1 02-02-2004 08:33 AM
Good introductory C programming tutorial ClayOgre Programming 2 01-28-2003 11:02 PM
New to cron programming: need to find a good tutorial lhoff Programming 1 03-31-2002 02:00 PM

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

All times are GMT -5. The time now is 09:33 PM.

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