Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-4041-

LOL IT'S C TIME

Name: Anonymous 2007-07-11 13:15 ID:hoSRp9Cj

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?

Name: Anonymous 2007-07-11 13:19 ID:dB/KDuBD

java

Name: Anonymous 2007-07-11 13:22 ID:Heaven

read SICP

Name: Anonymous 2007-07-11 13:29 ID:EYgm7xyk

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.

Name: Anonymous 2007-07-11 14:33 ID:hoSRp9Cj

>>3

I'm looking for language-specific information here. Abstract crap I can do very well on my own, thank you.

>>4
|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

...I meant serial port.

Name: Anonymous 2007-07-11 14:43 ID:gIkz0/WY

>>5

>>3
>"read SICP"
>- Bryce's Law

Name: Anonymous 2007-07-11 16:01 ID:3KkbGjeX

>...I meant serial port.

/dev/ttyS0

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: Anonymous 2007-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.

Name: Anonymous 2007-07-11 17:17 ID:Heaven

>>1
read man pages.

Name: Anonymous 2007-07-11 17:28 ID:EYgm7xyk

>>9
most man pages are incomplete and/or bad.

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: Anonymous 2007-07-11 18:05 ID:zBT/N6Zt

>>10
Translation: I don't know how to read manpages.

Name: Anonymous 2007-07-11 18:39 ID:hoSRp9Cj

>>11

And manpages are what?

Name: Anonymous 2007-07-11 18:40 ID:hoSRp9Cj

>>11

Also, I'm not looking for information on Unix, am I?

Name: Anonymous 2007-07-11 18:48 ID:rY/SVHcT

Actually, I'm looking for information on Unix, I just don't know it yet.

Name: Anonymous 2007-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: Anonymous 2007-07-11 19:16 ID:entyKWyj

Actualy, I am looking for information on Spiny Norman.

Name: Anonymous 2007-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: Anonymous 2007-07-11 20:33 ID:lWteE4Zg

Actually, I'm a complete retard, I just haven't dropped a toaster in my bathtub yet.

Name: Anonymous 2007-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.

Name: Anonymous 2007-07-11 21:08 ID:Heaven

>>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

Name: Anonymous 2007-07-11 21:39 ID:gIkz0/WY

>>19
No, by "retard", I mean "broken", mentally.

Name: Anonymous 2007-07-11 21:56 ID:ZnqaABLy

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: Anonymous 2007-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: Anonymous 2007-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: Anonymous 2007-07-11 22:08 ID:gIkz0/WY

DOGMA AND ``TIRED RHETORICE[sic\]"" IS ALL YOU'RE GONNA GET

Name: Anonymous 2007-07-12 0:14 ID:qwhna3BT

Sorry, what I meant was "everything sounds like a forced meme because most of it is".

Name: Anonymous 2007-07-12 2:33 ID:Heaven

>>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: Anonymous 2007-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]

...?

Name: Anonymous 2007-07-12 21:53 ID:Heaven

>>28
noob

Name: Anonymous 2007-07-12 23:56 ID:aABzBmR9

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.

-- save/load files
http://www.google.com.au/search?q=open+a+file+in+c
http://www.thinkage.ca/english/gcos/expl/c/lib/fopen.html

-- send/receive data using (serial) ports
as posted earlier, on unix open the file /dev/ttyS0 and then read/write to it.

Name: Anonymous 2007-07-13 1:52 ID:9I30q8gt

>>30
And if you're not Unix, hm?

Name: Anonymous 2007-07-13 5:58 ID:weRnsXDO

Name: Anonymous 2008-12-12 11:23

bampu

Name: Anonymous 2008-12-12 11:30

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: Anonymous 2008-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: Anonymous 2008-12-12 12:15

>>34
You're dumb, but -> shouldn't have been included.

Name: Anonymous 2008-12-12 12:19

>>36
-> shouldn't have been included.
Why?

Name: Anonymous 2008-12-12 12:36

>>34
Because they are different operations and anbiguous operator overloading belongs in C++, not C.

Name: Anonymous 2008-12-12 12:42

>>38
lolwut

Name: Anonymous 2008-12-12 12:58

>>35
I'm writing a lot C already, post code where it's possible or shut up.

>>38
It is completely unambiguous.

Name: Anonymous 2008-12-12 13:22

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: Anonymous 2008-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.

Name: Anonymous 2008-12-12 14:00

>>36 here
>>38
Idiot.
>>37
It's redundant.

Name: Anonymous 2008-12-12 14:01

>>41
Do you not know what unambiguous means?

Name: Anonymous 2008-12-12 14:16

>>42
We're seem to be having

Name: Anonymous 2008-12-12 15:13

>>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.

Name: Anonymous 2008-12-12 16:20

You are missing the pointer.
fix'd

Name: Anonymous 2008-12-12 17:42

>>46
It's semantically ambiguous, like overloading "+" to mean string concatenation.

Name: Anonymous 2008-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: Anonymous 2008-12-12 18:29

>>37
If redundancy was an issue, we'd all be writing in assembly.

Name: Anonymous 2008-12-12 18:58

>>50
What.

Name: Anonymous 2008-12-12 19:02

>>50
Thanks for the advice, PoppaVic.

Name: Anonymous 2008-12-12 19:20

>>49
Maybe Dennis Ritchie dislikes parentheses.

Name: Anonymous 2008-12-12 19:45

>>53
Then he should have fixed the operator precedence.

Name: Anonymous 2008-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.

Name: Anonymous 2008-12-13 2:19

>>55
CONCATENATION, you goddamn moron.

Name: Anonymous 2008-12-13 2:23

>>55
Uh, don't you mean Concatenation? Dumbass.

Name: Anonymous 2008-12-13 2:33

>>56,57
Concatenation-mind

Name: Anonymous 2008-12-13 2:54

>>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: Anonymous 2008-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.

Name: Anonymous 2008-12-13 7:26

Name: Anonymous 2008-12-13 9:27

>>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: Anonymous 2008-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'.

Name: Anonymous 2008-12-13 10:05

>>63
Touché.

Name: Anonymous 2008-12-13 10:16

>>63
I AM SHOCKED

Name: Anonymous 2008-12-13 10:16

>>63
It's not, because a is either a variable or a type name.

Name: Anonymous 2008-12-13 10:18

>>66
Which makes C's grammar non-context-free?

Name: Anonymous 2008-12-13 10:27

>>67
You don't know what "context-free grammar" means.

Name: Anonymous 2008-12-13 10:31

>>68
Indeed, I don't.

Name: Anonymous 2008-12-13 10:34

>>69
Look it up, mate. Wikipedia is just one step away.

Name: Anonymous 2008-12-13 10:52

The current state of the parser (i.e. the "context") does not have to be known in order to continue parsing correctly.

Name: Anonymous 2008-12-13 11:00

>>71
Close [spoier](well, not really)[/spoiler], but no cigar.

Name: Anonymous 2008-12-13 12:02

>>72
Close, but no spoiler.

Name: Anonymous 2008-12-13 12:05

>>73
Thanks, I hadn't noticed.

Name: Anonymous 2008-12-13 14:27

[b]THIS IS /prog/
EVERY [b[[i][o][u]BBCODE FAILURE[/i[[/b][//u]{o] WILL BE POINTED OUT
NO EXCEPTION[/b]

Name: Anonymous 2008-12-13 15:24

When you fail BBCode, you die for real.

Name: Anonymous 2008-12-13 18:04

>>75
BBCODEFAILURE

Name: Anonymous 2011-02-04 13:13

Don't change these.
Name: Email:
Entire Thread Thread List