Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. opening file !!help me

opening file !!help me

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mitil20390482304
    wrote on last edited by
    #1

    Hi I posted a message yesterday as well but i dont still get it what should i do.... it is very simple.. but i have never worked with forms and i only know about consule project. iostream!! I am trying to build a form and run a specific application with it. I am already made the project as a console project using fstream. I want to get the name of the file from the user in a specific text Box and then open it as follows: char fileName[]; ifstream infile; infile.open(fileName); However what i get from the textbox is String *f = textBox->Text; How can i convert this to char[]? I have already tried char fileName[]=f->ToCharArray(); but it seams there is a problem and i cant convert _wchar to char!! how can I do this? is there another way to open the file ?

    V 1 Reply Last reply
    0
    • M mitil20390482304

      Hi I posted a message yesterday as well but i dont still get it what should i do.... it is very simple.. but i have never worked with forms and i only know about consule project. iostream!! I am trying to build a form and run a specific application with it. I am already made the project as a console project using fstream. I want to get the name of the file from the user in a specific text Box and then open it as follows: char fileName[]; ifstream infile; infile.open(fileName); However what i get from the textbox is String *f = textBox->Text; How can i convert this to char[]? I have already tried char fileName[]=f->ToCharArray(); but it seams there is a problem and i cant convert _wchar to char!! how can I do this? is there another way to open the file ?

      V Offline
      V Offline
      vancouver777
      wrote on last edited by
      #2

      Are you trying to get the string from editobx? If you go with MFC.. CString str_FileName; CEdit * pEditBox = ( CEdit * )GetDlgItem( ResourceIDForYourTextBox ); pEditBox -> GetWindowText( str_FileName ); I am not sure if this is the answer to your question. Shin

      M 1 Reply Last reply
      0
      • V vancouver777

        Are you trying to get the string from editobx? If you go with MFC.. CString str_FileName; CEdit * pEditBox = ( CEdit * )GetDlgItem( ResourceIDForYourTextBox ); pEditBox -> GetWindowText( str_FileName ); I am not sure if this is the answer to your question. Shin

        M Offline
        M Offline
        mitil20390482304
        wrote on last edited by
        #3

        no i am just using a simple form. still dont get what u r trying to say!?

        H 1 Reply Last reply
        0
        • M mitil20390482304

          no i am just using a simple form. still dont get what u r trying to say!?

          H Offline
          H Offline
          hyph3n
          wrote on last edited by
          #4

          I think hes using Managed C++ not MFC..

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups