Thread: Reading in more than one file

  1. #1
    Registered User
    Join Date
    Apr 2010
    Posts
    38

    Reading in more than one file

    I am creating a recipe search for my wife: she has hundreds of recipes, all in different txt files. Is there a way of reading in more than one file? I have a folder with all of the recipe files in it and would like to run a loop to create an object of each recipe.

    Can you loop through a folder to read all the files?

  2. #2
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336

  3. #3
    Registered User
    Join Date
    Apr 2010
    Posts
    38
    Nice one, Thanks.

  4. #4
    Registered User
    Join Date
    Apr 2010
    Posts
    38
    Having some problems, tried the win32 code and it does not like converting const chars to LWPTS. Using VS10. Good practice debugging I guess.

  5. #5
    Registered User
    Join Date
    Apr 2010
    Posts
    38
    Never mind, I had to change the configuration in VS:
    taken from
    FAQ: Cannot convert from 'const char [..]' to 'LPCTSTR'

    Resolution

    You will have to do one of two things:

    1. Change your project configuration to use multibyte strings. Press ALT+F7 to open the properties, and navigate to Configuration Properties > General. Switch Character Set to "Use Multi-Byte Character Set".
    2. Indicate that the string literal, in this case "Hello world!" is of a specific encoding. This can be done through either prefixing it with L, such as L"Hello world!", or surrounding it with the generic _T("Hello world!") macro. The latter will expand to the L prefix if you are compiling for unicode (see #1), and nothing (indicating multi-byte) otherwise.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. opening empty file causes access violation
    By trevordunstan in forum C Programming
    Replies: 10
    Last Post: 10-21-2008, 11:19 PM
  2. Formatting the contents of a text file
    By dagorsul in forum C++ Programming
    Replies: 2
    Last Post: 04-29-2008, 12:36 PM
  3. Replies: 3
    Last Post: 03-04-2005, 02:46 PM
  4. Possible circular definition with singleton objects
    By techrolla in forum C++ Programming
    Replies: 3
    Last Post: 12-26-2004, 10:46 AM
  5. System
    By drdroid in forum C++ Programming
    Replies: 3
    Last Post: 06-28-2002, 10:12 PM