Hi /prog/, I have some experience with C, but I don't know how to do much except take text input, save variables, calculate, and print text out. What should I read to learn to do things like display graphics, save/load files, send/receive data using ports, et cetera?
save/load files
wait, you know how to ``print text out'' but you don't know that?
You need to read about file I/O. when you ``print text out'' you're basicly using some file IO operation to write to stdout.
send/receive data using ports
well first you gotta clear that concept in your mind before you attempt to write some socket I/O program. i recommend teh TCP/IP protocl
display graphics
use some 3rd party library/etc like wxWidgets, GTK, Qt and friends.
You need to read about file I/O. when you ``print text out'' you're basicly using some file IO operation to write to stdout.
Name:
Anonymous2007-07-11 16:59 ID:d89mCTBA
>>1
You might want to look at writing GUI applications with GTK or QT, but expect it to be a little more work than taking input and evaluating whether the user's name is "Ted" or not.
The C programming language - by K&R
bmurali.c.tripod.com/Documents/dritchie.pdf ISO/IEC - 9899 - Programming languages - C www.nirvani.net/docs/ansi_c.pdf
Name:
Anonymous2007-07-11 18:05 ID:zBT/N6Zt
>>10
Translation: I don't know how to read manpages.
Also, I'm not looking for information on Unix, am I?
Name:
Anonymous2007-07-11 18:48 ID:rY/SVHcT
Actually, I'm looking for information on Unix, I just don't know it yet.
Name:
Anonymous2007-07-11 19:08 ID:hoSRp9Cj
Actualy, I am looking for information on Unix, just not in this thread. I'd like my programs to run with FreeDOS too. :)
Name:
Anonymous2007-07-11 19:16 ID:entyKWyj
Actualy, I am looking for information on Spiny Norman.
Name:
Anonymous2007-07-11 19:51 ID:gIkz0/WY
"Actually, I'm looking for information on Unix, I just don't know it yet."
- Bryce's law
Name:
Anonymous2007-07-11 20:33 ID:lWteE4Zg
Actually, I'm a complete retard, I just haven't dropped a toaster in my bathtub yet.
Name:
Anonymous2007-07-11 20:41 ID:hoSRp9Cj
If by "retard" you mean "some who is held back", then yes, I'm being held back by zealots who demand I take in their philosophy instead of letting me have the information I want.
>>19
OKAY YOU FUQIN ANGERED AN EXPERT PROGRAMMER
GODFUCKIGNDAMN
FIRST OF ALL, YOU DONT FUQIN KNOW WHAT A MAN PAGE IS
SECONDLY, THIS IS /prog/ DO NOT DEMAND USEFUL ANSWERS THE WAY YOU WANT THEM TO BE
THIRDLY PROGRAMMING IS ALL ABOUT PHILOSOPHY AND ``ABSTRACT BULLSHITE'' THAT YOU WILL NEVER COMPREHEND
AND FUQIN LASTLY, FUCK OFF WITH YOUR BULLSHYT
EVERYTHING HAS ALREADY BEEN ANSWERED IN>>3,4,10
OKAY YOU FUQIN ANGERED AN EXPERT PROGRAMMER
GODFUCKIGNDAMN
FIRST OF ALL, YOU DONT FUQIN KNOW WHAT A MAN PAGE IS
SECONDLY, THIS IS /prog/ DO NOT DEMAND USEFUL ANSWERS THE WAY YOU WANT THEM TO BE
THIRDLY PROGRAMMING IS ALL ABOUT PHILOSOPHY AND ``ABSTRACT BULLSHITE'' THAT YOU WILL NEVER COMPREHEND
AND FUQIN LASTLY, FUCK OFF WITH YOUR BULLSHYT
EVERYTHING HAS ALREADY BEEN ANSWERED IN >>3,4,10
Name:
Anonymous2007-07-11 21:58 ID:hoSRp9Cj
I'll be reading all of these things you told me to, you know, I'd just like to know why you want me to read it. Otherwise, I'll jsut assume it's an article on how Ubuntu needs to have a red blinking cursor to make it easier to find. I love "PHILOSOPHY AND ``ABSTRACT BULLSHITE''", that's why I want to program in the first place, I don't like "DOGMA AND ``TIRED RHETORICE''", which is all anyone uses around here.
And actualy, I didn't notice >>10 until now. Thanks, >>10!
Name:
Anonymous2007-07-11 22:07 ID:hoSRp9Cj
Also, thanks for the help, I'll try to take your advice into account, but I'm still going to put making programming fun over doing things "professionally". I belaive SICP agrees with me on that point: http://mitpress.mit.edu/sicp/full-text/book/book-Z-H-3.html
Anyway, I'm glad you've been as patient with me as you were. I'll be sure to come back after I've read up and made some programs for myself.
Name:
Anonymous2007-07-11 22:08 ID:gIkz0/WY
DOGMA AND ``TIRED RHETORICE[sic\]"" IS ALL YOU'RE GONNA GET
Name:
Anonymous2007-07-12 0:14 ID:qwhna3BT
Sorry, what I meant was "everything sounds like a forced meme because most of it is".
>>26
spent some time to actually read >>20's post. SECONDLY, THIS IS /prog/ DO NOT DEMAND USEFUL ANSWERS THE WAY YOU WANT THEM TO BE
that means, we're here *mostly* for the lulz, but we'll have some seriose talk from time to time
seriose now; SICP is a good book but you do not need to read it in order to write good programs. achieving satori is a differend story though ... ;)
Name:
Anonymous2007-07-12 18:49 ID:aJTNj4qL
>>27
[quote]SICP is a good book but you do not need to read it in order to write good programs[/quote]
The way I learn programming is to figure out something I want to do first; often a difficult step. Come up with some project you want to make.
From that, you can come up with a fairly clear list of what you need to know, and then research that.
-- things like display graphics
Use a library for this. If you wanted to make a game, for instance, you want to look up either a suitable sprite library or some sort of openGL or directX library. Once installed, these will provide functions to do graphics.
You could learn how to do it from a lower level instead, but it frankly isn't worth the effort.
And now, for something completely different: why did Dennis decide to have two operators, . and ->? It's not like there are cases when you can use both any of them in the same place, so why not have only .? I'm sure there was some reason behind this.
Name:
Anonymous2008-12-12 11:36
It's not like there are cases when you can use both any of them in the same place, so why not have only .?
Write more C.
Name:
Anonymous2008-12-12 12:15
>>34
You're dumb, but -> shouldn't have been included.
id.field // access a field of an instance of some struct.
ptr->field // dereference a pointer to struct and access a field of the resulting instance.
How the fuck is it unambiguous? IHBT
Name:
Anonymous2008-12-12 13:24
>>38,40
OH WOW! We're seem to be having a three-way-argument here. We all disagree with each other and you both are wrong.
>>43
I am greatly offended by you calling me dumb. Please apologize immediately or I will resort to leaving this forum.
>>41
You are missing the point. What I am offering is to make . both // access a field of an instance of some struct. and // dereference a pointer to struct and access a field of the resulting instance.. I am claiming that it won't introduce any ambiguity.
>>46
It's semantically ambiguous, like overloading "+" to mean string concatenation.
Name:
Anonymous2008-12-12 18:23
I think the more important question is, why does C have -> in the first place, when the same can be accomplished by dereferencing the pointer and then referencing the member: (*a).b versus a->b. It's much more obvious what it's doing at a glance, and if the operator precedence for such things weren't so screwy it wouldn't even be more characters to type. *a.b reads intuitively from left to right: "dereference the pointer 'a', and access field 'b'".
Name:
Anonymous2008-12-12 18:29
>>37
If redundancy was an issue, we'd all be writing in assembly.
>>53
Then he should have fixed the operator precedence.
Name:
Anonymous2008-12-13 2:07
>>48
It's not it's not it's not ambiguous! Post code where it would be, then we're talking. + is not used for string catenation in C because you can't catenate strings in C. And + is very successfully used in other languages for string catenation.
>>56-58
No, I mean catenate.
Catenate as in ``To connect in a series of ties or links; form into a chain''.
Just like the cat program does.
Name:
Anonymous2008-12-13 3:03
Except that catenate typically refers to the chemistry definition, while concatenate refers to the CS definition. Either way, we have been trolled, or ``WHBT'' as the saying goes.
>>55
If C had a primitive string type, I doubt that "+" would be used for string concatenation, because in C EVERY DISTINCT OPERATION HAS ITS OWN EXCLUSIVE OPERATOR. Except for "-" and "*" wich have two different meanings each, especifically one meaning for the binary version and another for the unary version. But that's because you'd never mistake a binary operator for a unary one, so there's no ambiguity.
Name:
Anonymous2008-12-13 9:50
>>62
Actually a * b; is ambiguous because it can mean either `multiply a by b, then disregard the result' or `declare b as a pointer to type a'.