C tutorials for a beginner

Member
Posts: 51
Joined: 2005.07
Post: #16
I have a problem with thsi code.

this is the result:
Code:
[Session started at 2005-09-11 19:40:41 -0700.]

What is your name?  [b]Matthew Liebrich[/b]
How old are you?  Your name is Matthew, and you are Lie years old.

Executable “Testing codes” has exited with status 0.
bold means my input. when there's a space in the name, it takes it as the age...
Quote this message in a reply
Member
Posts: 51
Joined: 2005.07
Post: #17
couls someone post a small program that would just show images? if you do, please include the image files! i just want to see which commands and such are needed. maybe a keyboard input code too?
Quote this message in a reply
Member
Posts: 208
Joined: 2005.04
Post: #18
Tyaedalis Wrote:when there's a space in the name, it takes it as the age...

That's the way scanf works. Read the man pages on scanf for all the gory details:
type man scanf in a terminal
Quote this message in a reply
Member
Posts: 208
Joined: 2005.04
Post: #19
Tyaedalis Wrote:couls someone post a small program that would just show images? if you do, please include the image files! i just want to see which commands and such are needed. maybe a keyboard input code too?

This kind of stuff is not for beginner C programmers. Stick to text only programs for the moment if you want to learn C. If you want to jump right into high-level stuff, start with a higher level language like objective-C, Ruby, Python, or Lua. That said, you may want to check out SDL. It's a C library which simplifies these tasks.

I'd strongly suggest learning objective-C + Cocoa if you're in a hurry to do such high level things (on the Mac, anyway).
Quote this message in a reply
Member
Posts: 51
Joined: 2005.07
Post: #20
yeah, i want to learn objective-c+cocoa. and SDL can work with objective-c, too right?
Quote this message in a reply
Member
Posts: 208
Joined: 2005.04
Post: #21
Tyaedalis Wrote:yeah, i want to learn objective-c+cocoa. and SDL can work with objective-c, too right?

Yes, you can get SDL to work with objective-C... but why? One of the main advantages of SDL is that it's cross-platform (as opposed to Cocoa, which is pretty much Mac-only). About the only thing Cocoa doesn't give you is a simplified HID input (joystick/gamepad) API. Cocoa by itself should have everything you need at the moment.

THE best book on Cocoa is Aaron Hillegass' "Cocoa Programming for Mac OS X".

Also be sure to read some of the tutorials on Cocoa Dev Central.
Quote this message in a reply
Member
Posts: 51
Joined: 2005.07
Post: #22
ok. i will. but what do you think i could make better on my current program?
Quote this message in a reply
Member
Posts: 208
Joined: 2005.04
Post: #23
do you mean "how can I fix the spacing bug?", or do you mean "what other features could I add to my program to get me practising C?"?
Quote this message in a reply
Moderator
Posts: 1,140
Joined: 2005.07
Post: #24
You could always use fgetc to get the input 1 character at a time until you reach a new line for the name.
Quote this message in a reply
Post Reply