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. system() , need help please

system() , need help please

Scheduled Pinned Locked Moved C / C++ / MFC
c++help
3 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
    moraalg
    wrote on last edited by
    #1

    what code or function can i use to display the files in a directory in a console( but only the file names, none of the detailed stuff like is shown in DIR) and is it possible to transfer a variable in my C++ program to DOS, like if i told them to input the name of the file they want to open, but it needs to be compatable with up to 900 files in the folder(so i can't use switch() ) thanks, not sure if this can be done though

    C M 2 Replies Last reply
    0
    • M moraalg

      what code or function can i use to display the files in a directory in a console( but only the file names, none of the detailed stuff like is shown in DIR) and is it possible to transfer a variable in my C++ program to DOS, like if i told them to input the name of the file they want to open, but it needs to be compatable with up to 900 files in the folder(so i can't use switch() ) thanks, not sure if this can be done though

      C Offline
      C Offline
      Chris Losinger
      wrote on last edited by
      #2

      write your own code to list the files. use FindFirstFile/FindNextFile. -c


      When history comes, it always takes you by surprise.

      Fractals

      1 Reply Last reply
      0
      • M moraalg

        what code or function can i use to display the files in a directory in a console( but only the file names, none of the detailed stuff like is shown in DIR) and is it possible to transfer a variable in my C++ program to DOS, like if i told them to input the name of the file they want to open, but it needs to be compatable with up to 900 files in the folder(so i can't use switch() ) thanks, not sure if this can be done though

        M Offline
        M Offline
        Mike Nordell
        wrote on last edited by
        #3

        moraalg wrote: what code or function can i use to display the files in a directory in a console( but only the file names, none of the detailed stuff like is shown in DIR) Have you tried to, at a command prompt, type dir /? ? If you had, you should probably have seen a switch "/B". If not, you are using an older OS that won't support this, and have to FindFirstFile&co yourself. is it possible to transfer a variable in my C++ program to DOS To DOS?! Are you really sure you are using VC1.52c and really sure you want to "transfer" it to dos??? like if i told them to input the name of the file they want to open, but it needs to be compatable with up to 900 files in the folder(so i can't use switch() ) Um, you want a user to be able to type in from 1 to 900 (!) filenames that you are then to operate on (not that I see how this has anything to do with sending stuff to DOS)? If you really want the users to type this stuff in, one filename at a time, use cin. If you on the other hand can accept (the more reasonable) argv/argc way of handling this, just loop over argv and "do your thing".

        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