Thread: meaning

  1. #1
    Registered User
    Join Date
    Dec 2001
    Posts
    227

    Post meaning

    what does buff means..
    like i see program that has

    buff[256]

    can anyone tell me what does this means. thenax

  2. #2
    Registered User
    Join Date
    Jan 2002
    Posts
    49
    I think you have got :
    char buff[256]
    which declares an array of 256 chars (and is used as a buffer maybe)

  3. #3
    Registered User
    Join Date
    Dec 2001
    Posts
    227
    ya that is what i meant buffer as i see now i posted it wrong.. so what is it really doing like i have this program that i keep getting erros..

    #include <stdio.h>
    #include <string.h>

    int main(void)

    {

    char buffer[256];

    printf(" enter name and press enter ");
    fgets(buffer,256,stdin);
    printf(" \nyour name has %d chars and spaces\n",stdin( buffer )-1);
    return 0;
    }

    now im tring to see what this program doe... (its in linux) the error that i get is "test.c:12: called object is not a function" hhmm any help... thanx

  4. #4
    Registered User
    Join Date
    Jan 2002
    Posts
    49
    char buffer[256] is just an array in which input is stored.
    Try :

    #include <stdio.h>
    #include <string.h>

    int main(void)
    {
    char buffer[256];
    printf(" enter name and press enter ");
    fgets(buffer,256,stdin);
    printf(" \nyour name has %d chars and spaces\n",strlen(buffer));
    return 0;
    }

  5. #5
    ....
    Join Date
    Aug 2001
    Location
    Groningen (NL)
    Posts
    2,380
    >stdin( buffer )-1);

    That was what went wrong, stdin is not a function.

  6. #6
    Registered User
    Join Date
    Dec 2001
    Posts
    227
    so what is that -1 for if you dont mind me asking

  7. #7
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    > so what is that -1 for if you dont mind me asking

    It's not for anything in this case, because it was used wrong.
    What it was probably supposed to be for, was use with fgets, which was actually using it incorrectly anyway.
    The '-1' is not needed at all for correct usage here.

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

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. what is the meaning of "offset"
    By cromologic in forum C Programming
    Replies: 5
    Last Post: 05-02-2008, 09:09 AM
  2. the meaning of " >> "
    By arian in forum C++ Programming
    Replies: 8
    Last Post: 03-30-2005, 10:40 AM
  3. The Meaning of Life: A Trick Question?
    By chix/w/guns in forum A Brief History of Cprogramming.com
    Replies: 14
    Last Post: 07-12-2004, 07:53 PM
  4. would you help me with Linked list, please?
    By unhwan in forum C Programming
    Replies: 1
    Last Post: 06-11-2002, 12:24 AM
  5. WINAPI: Meaning of HDC ?
    By Mecnels in forum Windows Programming
    Replies: 1
    Last Post: 01-21-2002, 10:06 AM