Thread: Searching in a file

  1. #1
    Registered User
    Join Date
    Apr 2005
    Posts
    15

    Searching in a file

    I'm wanting to create a C++ program that uses kind of a config.ini file.

    Basically I'm wanting to have my program search through a file for [choice1] and return it's value, "thisischoiceone", in a file that contains something like, "[choice1]=thisischoiceone"

    It won't hurt my feelings if someone tells me to go search, it WILL hurt my feelings if you tell me to go search but don't help me out with any search terms. I'll cry, I really will.

  2. #2
    Registered User
    Join Date
    Aug 2005
    Location
    Austria
    Posts
    1,990
    I don't want to hurt your feelings so I won't comment. Try this
    Kurt

  3. #3
    Registered User
    Join Date
    Jun 2005
    Location
    Stockholm, Sweden
    Posts
    64
    How can you need help with search terms?

    Start with what you're looking for:
    Information about ini files
    Related to the language C++

    Guess what your search terms should be? Remember to enclose C++ in double quotes, otherwise google will interpret the + characters as search term modifiers.

  4. #4
    Registered User
    Join Date
    Apr 2005
    Posts
    15
    Quote Originally Posted by kungtotte
    How can you need help with search terms?

    Remember to enclose C++ in double quotes, otherwise google will interpret the + characters as search term modifiers.
    So that's what I was doing wrong.

    Thanks.

    EDIT: Actually, I took away the quotes and it still worked. I dunno, maybe it was the lack of sleep, oh well, still.... thanks.
    Last edited by bliss; 09-09-2005 at 05:41 AM.

  5. #5
    Registered User
    Join Date
    Apr 2005
    Posts
    15
    Umm.... okay. I got links to source code that when compiled, produces a slew of errors. I put all of the header files in the right directory, tried compiling it, nope...

    All I get from searching with the terms ' ini file "c++" ' or ' config file "c++" ' or ' configuration file "c++" ' is either source code that won't compile because either it's ..........ed or I just don't know how to compile source code, or instructions for editing a plaintext ini file with notepad.

    All that aside, none of that will really help me seeing as it's a TOOL, pre-made and packaged, ready to use. Doesn't teach me squat about how to search a text file, and extract a string, which is what I want.... TO LEARN it.

    Maybe I'm just not '1337' enough, oh well, thanks anyway.
    Last edited by bliss; 09-09-2005 at 07:42 PM.

  6. #6
    Registered User
    Join Date
    Apr 2005
    Posts
    15
    For anyone else who cares to know:

    WritePrivateProfileString() and GetPrivateProfileString() are two functions a friend suggested to look up. That produced a lot of search results and answered my question.

    'preciate the help guys.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Data Structure Eror
    By prominababy in forum C Programming
    Replies: 3
    Last Post: 01-06-2009, 09:35 AM
  2. gcc link external library
    By spank in forum C Programming
    Replies: 6
    Last Post: 08-08-2007, 03:44 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. Need a suggestion on a school project..
    By Screwz Luse in forum C Programming
    Replies: 5
    Last Post: 11-27-2001, 02:58 AM