ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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...
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.
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!)
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
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.
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
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).
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.
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
"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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.