what is the difference between thses commands?

This is a discussion on what is the difference between thses commands? within the C Programming forums, part of the General Programming Boards category; what is the difference between getc and getchar ?? what is the difference between putc and putchar ??...

  1. #1
    Banned
    Join Date
    Oct 2008
    Posts
    1,535

    what is the difference between thses commands?

    what is the difference between getc and getchar
    ??

    what is the difference between putc and putchar
    ??

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Don't you have a reference book? You should buy one. Otherwise, learn to use a search engine.


    Quzah.
    Hope is the first step on the road to disappointment.

  3. #3
    Banned
    Join Date
    Oct 2008
    Posts
    1,535
    i read them i cant spot the differece

  4. #4
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    You clearly aren't making any effort at all. All I do is type "man getc" into my browser, and presto:
    getc

    Then I read the nice little paragraph on what each one does:
    The getc() function acts essentially identically to fgetc(), but is a
    macro that expands in-line.

    The getchar() function is equivalent to getc(stdin).
    I'll let you figure out the second pair.


    Quzah.
    Hope is the first step on the road to disappointment.

  5. #5
    Banned
    Join Date
    Oct 2008
    Posts
    1,535
    why puts("") means go to a new line??

  6. #6
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Because that's the way they wrote it. Seriously dude, buy a reference book, or learn to use a search engine.

    Quzah.
    Hope is the first step on the road to disappointment.

  7. #7
    Banned
    Join Date
    Oct 2008
    Posts
    1,535
    but its not puts('\n')

  8. #8
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    And? Some functions read characters. Some read lines. Some display characters. Some display lines.


    Quzah.
    Hope is the first step on the road to disappointment.

  9. #9
    Super Moderator
    Join Date
    Sep 2001
    Posts
    4,913
    It's just defined as being that way. This is also from an online man page that I found as my first entry in a google search:

    puts(3,n)() writes the string(3,n) s and a trailing newline to stdout.
    Quzah is right - with 1350 posts you really should have learned how to find things like this on your own by now.

  10. #10
    Registered User slingerland3g's Avatar
    Join Date
    Jan 2008
    Location
    Seattle
    Posts
    603
    Lol, I really think this post is only to disturb the slumber of quzah from his den.

  11. #11
    and the hat of sweating
    Join Date
    Aug 2007
    Location
    Toronto, ON
    Posts
    3,545
    How can you possibly ask what the difference is when they have different function signatures???

    int getc( FILE* )
    int getchar( void )

    int putc( int, FILE* )
    int putchar( int )
    "I am probably the laziest programmer on the planet, a fact with which anyone who has ever seen my code will agree." - esbo, 11/15/2008

    "the internet is a scary place to be thats why i dont use it much." - billet, 03/17/2010

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Review required for program of date difference
    By chottachatri in forum C Programming
    Replies: 6
    Last Post: 10-31-2008, 12:46 PM
  2. What's the difference between the 2 CVS commands?
    By meili100 in forum C++ Programming
    Replies: 1
    Last Post: 09-03-2008, 02:12 PM
  3. Difference Equations / Recurrence Relations
    By DavidP in forum A Brief History of Cprogramming.com
    Replies: 4
    Last Post: 10-05-2007, 11:26 AM
  4. Replies: 2
    Last Post: 07-27-2007, 01:48 PM
  5. What's the difference between var++ and ++var
    By ulillillia in forum C Programming
    Replies: 6
    Last Post: 05-31-2007, 03:27 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21