Thread: fopen to return string?

  1. #1
    Third Eye Babkockdood's Avatar
    Join Date
    Apr 2010

    fopen to return string?

    Hello, all. I'm having a bit of a problem (why else would I have made a new thread? ). How can I get fopen to return the contents of the file it read as a string? I've tried several things, but nothing seems to work.

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    fopen doesn't read anything. It simply opens a file.

    Hope is the first step on the road to disappointment.

  3. #3
    Registered User
    Join Date
    Jun 2009
    Once you have opened a file with fopen, if you want strings, read up on fgets()

    fgets - C++ Reference

  4. #4
    Premier Member
    Join Date
    May 2010
    Or if you want straight up input from the file, use fscanf (functions exactly like scanf, but on the current "place" you are at in your file).

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Unable to compare string with 'getter' returned string.
    By Swerve in forum C++ Programming
    Replies: 2
    Last Post: 10-30-2009, 05:56 PM
  2. C++ ini file reader problems
    By guitarist809 in forum C++ Programming
    Replies: 7
    Last Post: 09-04-2008, 06:02 AM
  3. Inheritance Hierarchy for a Package class
    By twickre in forum C++ Programming
    Replies: 7
    Last Post: 12-08-2007, 03:13 PM
  4. Linked List Help
    By CJ7Mudrover in forum C Programming
    Replies: 9
    Last Post: 03-10-2004, 09:33 PM
  5. lvp string...
    By Magma in forum C++ Programming
    Replies: 4
    Last Post: 02-26-2003, 11:03 PM
Website Security Test