Searching in a file

This is a discussion on Searching in a file within the C++ Programming forums, part of the General Programming Boards category; I'm wanting to create a C++ program that uses kind of a config.ini file. Basically I'm wanting to have my ...

  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
    ZuK
    ZuK is offline
    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, 08: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, 01:46 PM
  4. Possible circular definition with singleton objects
    By techrolla in forum C++ Programming
    Replies: 3
    Last Post: 12-26-2004, 09:46 AM
  5. Need a suggestion on a school project..
    By Screwz Luse in forum C Programming
    Replies: 5
    Last Post: 11-27-2001, 01:58 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21