Thread: Printing out contents of a file to the screen

  1. #16
    Registered User
    Join Date
    Aug 2002
    Posts
    34
    Thanks Hammer.

    Always good.

  2. #17
    Registered User
    Join Date
    Dec 2001
    Posts
    227
    Originally posted by Simon
    I posted it before but are buff and bufsiz standard variable names, do they have to be used and are they only used to show the size of the file?
    No it does not need to be used.. you can use...

    buf[80]

    for example
    Code:
    int main()
    {
      char buf[80];
       printf(" type in a string\n");
       fgets(buf,80,stdin);
       printf(" your string is %s ",buf);
       return 0;
    }
    Note that you need to use the "string.h"
    Only the strong survives.

  3. #18
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    >>Note that you need to use the "string.h"
    For what? The only header needed for your short example code is stdio.h.
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  4. #19
    Registered User
    Join Date
    Dec 2001
    Posts
    227
    ahh yes you are right... hmm i always used string.h for that.. errr ohh well.. thanx for the info
    Only the strong survives.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Feedback: Functional Specification Wording
    By Ragsdale85 in forum C++ Programming
    Replies: 0
    Last Post: 01-18-2006, 04:56 PM
  2. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM
  3. Encryption program
    By zeiffelz in forum C Programming
    Replies: 1
    Last Post: 06-15-2005, 03:39 AM
  4. Problem With search a file and printing to screen
    By sell682 in forum C++ Programming
    Replies: 4
    Last Post: 05-02-2004, 05:55 AM
  5. simulate Grep command in Unix using C
    By laxmi in forum C Programming
    Replies: 6
    Last Post: 05-10-2002, 04:10 PM