Insert characters from txt files into Edit Box

Discussion in 'MFC' started by tonini, May 31, 2009.

  1. tonini

    tonini New Member

    Joined:
    May 31, 2009
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    Study
    Location:
    Split, Croatia
    How to read-in character's into Edit Box from txt file?
     
  2. NewsBot

    NewsBot New Member

    Joined:
    Dec 2, 2008
    Messages:
    1,267
    Likes Received:
    2
    Trophy Points:
    0
    Read the text file into a string and then use the SetWindowText to show them into edit box
     
  3. Vyasa

    Vyasa New Member

    Joined:
    Jun 16, 2010
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    FILE *fp;
    CString str;
    fp = fopen("C:\\vyasa.txt","rb+");
    fread(str,24,1,fp);
    m_edit.SetWindowText(str);
    fclose(fp);

    Where m_edit is the member variable of the edit control.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice