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. I don't quite get this thing I've noticed

I don't quite get this thing I've noticed

Scheduled Pinned Locked Moved C / C++ / MFC
c++question
6 Posts 4 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.
  • U Offline
    U Offline
    User 12941702
    wrote on last edited by
    #1

    If you just got done writing some C++ code and naturally you want to save the file, you tell Windows where you want to save it and then you will see in the bottom field the Save as Type question. If you choose .cpp, and just do that alone the file will not be saved as a C++ source file. I don't get it. Seems to me if you tell it that you want to save it as a .cpp source file then all you should have to do is just figure out what you want to name your file and that's all. But you actually have to give the file the .cpp extension yourself. You can't just do this: My Program You have to do this: My Program.cpp Why?

    D L 2 Replies Last reply
    0
    • U User 12941702

      If you just got done writing some C++ code and naturally you want to save the file, you tell Windows where you want to save it and then you will see in the bottom field the Save as Type question. If you choose .cpp, and just do that alone the file will not be saved as a C++ source file. I don't get it. Seems to me if you tell it that you want to save it as a .cpp source file then all you should have to do is just figure out what you want to name your file and that's all. But you actually have to give the file the .cpp extension yourself. You can't just do this: My Program You have to do this: My Program.cpp Why?

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #2

      Member 12974235 wrote:

      ...the file will not be saved as a C++ source file.

      What will it be saved as?

      Member 12974235 wrote:

      You can't just do this: My Program

      What happens if you do? What editor are you using?

      "One man's wage rise is another man's price increase." - Harold Wilson

      "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

      "You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles

      1 Reply Last reply
      0
      • U User 12941702

        If you just got done writing some C++ code and naturally you want to save the file, you tell Windows where you want to save it and then you will see in the bottom field the Save as Type question. If you choose .cpp, and just do that alone the file will not be saved as a C++ source file. I don't get it. Seems to me if you tell it that you want to save it as a .cpp source file then all you should have to do is just figure out what you want to name your file and that's all. But you actually have to give the file the .cpp extension yourself. You can't just do this: My Program You have to do this: My Program.cpp Why?

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        That is correct, Windows cannot guess what type your file is.

        U 1 Reply Last reply
        0
        • L Lost User

          That is correct, Windows cannot guess what type your file is.

          U Offline
          U Offline
          User 12941702
          wrote on last edited by
          #4

          Well if the drop down box says Save as .cpp file, Windows does not have to guess. It should be saved as a .cpp file. Otherwise we have a wasted box with useless info in it.

          L L 2 Replies Last reply
          0
          • U User 12941702

            Well if the drop down box says Save as .cpp file, Windows does not have to guess. It should be saved as a .cpp file. Otherwise we have a wasted box with useless info in it.

            L Offline
            L Offline
            Lost User
            wrote on last edited by
            #5

            I guess you think there is something special about a .cpp file. It is just a text file that (may) happen to contain C++ source code. But that means nothing to Windows, it is just a convenience for us humans.

            1 Reply Last reply
            0
            • U User 12941702

              Well if the drop down box says Save as .cpp file, Windows does not have to guess. It should be saved as a .cpp file. Otherwise we have a wasted box with useless info in it.

              L Offline
              L Offline
              leon de boer
              wrote on last edited by
              #6

              The file type recognition is controlled by windows and windows by default doesn't know what a .CPP is or many other types for that matter. More distinctly it doesn't know what program to associate to the file type. That is all done via the File Type Association widget in control panel in windows. The save file dialog is a common control dialog from windows and it is it that is directing the prompt. Usually any good installer for a C++ program makes the changes for association to the file type for you. So either you have a lazy installer for a C++ program or it made the association and you have since broken it. Whatever the case stop complaining about it and go fix it in the File Type Association widget in the windows control panel. If you need assistance an internet search on "File type association on Windows" should give you a multitude of links to work with. It's a bit like complaining when you click on a .BMP file it doesn't open it in the right editor, yeah so go fix it. As an extra helpful tip I can tell you that on the file type association it is useful to select plain text filter onto the .CPP file type. That allows windows searches to go inside your .CPP files on a text search. It is sometimes useful if you have a lot of code directories (like I do) to find a specific block of code if you know something unique about it. You can do a computer wide search for the text string in a .CPP file and it has saved me hours of searching.

              In vino veritas

              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