Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

C++ Help

Name: Anonymous 2009-03-29 4:09

I'm trying to read from a text file and write into a label one character at a time.  I'm new to programming so please don't eat me alive.  Instead of displaying the characters, it displays the numeric value of each character.  Am I going about this in a completely idiotic way?  Will you please tell me how I can either fix my code, or the correct way in which I should be doing this.  Thanks.

Here is my code:

void readFromFile()
{
    string s;

    fstream inFile("C:\\test.txt", ios::in);

    while (inFile >> s)
    {
        for(int i = 0; i < s.size(); i++)
        {
            switch(s[i])
            {
            case '!':
            case '.':
            case '?':
                this->lblTheReader->Text += s[i] + L" ";
                break;
            default:
                this->lblTheReader->Text += s[i];
            }
        }
        this->lblTheReader->Text += L" ";
    }

    inFile.close();
}

Name: Anonymous 2009-03-29 4:27

Use C IO libraries. C++ IO is shiPIG DISGUSTING.

Name: Anonymous 2009-03-29 7:01

what about my shipig?

Name: Anonymous 2011-02-03 0:07

Name: Anonymous 2011-02-04 15:32

Don't change these.
Name: Email:
Entire Thread Thread List