Thread: [HELP] Read text file in vc++ 2005

  1. #1
    Registered User
    Join Date
    May 2007
    Posts
    1

    [HELP] Read text file in vc++ 2005

    Im newbie here first let me say hello to all members of our forum

    I'm not a programmer . I only know little about vb6 by reading some ebook and source code .

    Now i want to do it in vc++ 2005 . But it really is diff than vb6 .

    I have some question here about read text file . I hope you will help me .

    Code:
    if (System::IO::File::Exists("settings.ini"))
    		{
    				System::IO::StreamReader^ sr = gcnew System::IO::StreamReader(System::IO::File::OpenRead("settings.ini"));
    				System::String^ text = sr->ReadToEnd();
    				this->textBox1->Text = text;
    				sr->Close();
    i have settings.ini file
    hp=0.2
    mp=0.2
    stm=0.2
    i read settings.ini and write to text .

    I have 3 combobox in Form1 . I want to read first Value (0.2) to combo1 next one to combo2 and last one to combo3 at form load event .
    in vb6 only some line of code i can do this
    Code:
    If Left(text, 2) = "hp" Then
                Combo1.Text = Mid(a, 4, 1)
            ElseIf Left(text, 2) = "mp" Then
                Combo1.Text = Mid(a, 4, 1)
            ElseIf Left(text, 3) = "stm" Then
                Combo1.Text = Mid(a, 5, 1)
            End If
    but i dont know how can i do this in vc++ 2005

    I hope you can help me . Thank you very much

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    I am afraid that you have to start by learning C++, otherwise the only thing we can do is to provide you the answers on a golden platter.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Inventory records
    By jsbeckton in forum C Programming
    Replies: 23
    Last Post: 06-28-2007, 04:14 AM
  2. How to read chars from a text file and use them in TChart
    By Bachatero in forum C++ Programming
    Replies: 1
    Last Post: 08-29-2006, 04:03 PM
  3. Batch file programming
    By year2038bug in forum Tech Board
    Replies: 10
    Last Post: 09-05-2005, 03:30 PM
  4. getline function to read 1 line from a text file
    By kes103 in forum C++ Programming
    Replies: 3
    Last Post: 10-21-2004, 06:21 PM
  5. simulate Grep command in Unix using C
    By laxmi in forum C Programming
    Replies: 6
    Last Post: 05-10-2002, 04:10 PM