Thread: Reading from a file using Visual C++?

  1. #1
    fe_yang
    Guest

    Reading from a file using Visual C++?

    hi,

    I have my assignment in C,
    and it requires me to read file from a file, in which the file is containing of string...

    if i put the file in this directory c:\vc\file.gen
    how to read the file?
    and is it reading the file is the same as scanf?

    thx all for the response,

    Ferdinand

  2. #2
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    First off, is this C or VC++ ? This is a C board, if you want VC++, use the Windows board.

    I'll give you a couple of clues for C.... investigate functions:
    fopen()
    fgets()
    fclose()

    There's a ton of code on this board doing this kind of thing, search and ye shall find !

    When you have code that doesn't work, post it here for further help, if you want.
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. A development process
    By Noir in forum C Programming
    Replies: 37
    Last Post: 07-10-2011, 10:39 PM
  2. Avoiding Global variables
    By csonx_p in forum Windows Programming
    Replies: 32
    Last Post: 05-19-2008, 12:17 AM
  3. Basic text file encoder
    By Abda92 in forum C Programming
    Replies: 15
    Last Post: 05-22-2007, 01:19 PM
  4. more then 100errors in header
    By hallo007 in forum Windows Programming
    Replies: 20
    Last Post: 05-13-2007, 08:26 AM
  5. Using 'if' with char arrays or string objects
    By c++_n00b in forum C++ Programming
    Replies: 36
    Last Post: 06-06-2002, 09:04 PM