Menu

Create a template help

2008-10-08
2012-09-26
  • Cody Westlund

    Cody Westlund - 2008-10-08

    I have a pretty simple question.

    I would like to make a template for all my programs that contains the following code:

    include <stdio.h>

    include <stdlib.h>

    int main(int argc, char* argv[])
    {

    system(&quot;pause&quot;);
    return 0;
    

    }

    We use this everyday in my comp. e. class and would like to have it easily available so i dont have to type it out all the time. And i dont want it to be able to save over the template file and the best thing would be for it to ask me what to save it as.

     
    • cpns

      cpns - 2008-10-08

      This is not important. You will spend far longer designing, writing, and testing your code that you will ever spend typing that code!

      Dev-C++ already has almost identical code in its default C console mode project template (File->New->New Project...). I suggest that you always use the project tool in any case.

      If you wish you can modify the templates or add your own, they are set up by simple text files in the c:\dev-cpp\templates folder.

      That said, it is so little effort that if you find that hard work, how are you ever going to cope with code that actually does something useful!?

      If not using the project tool (because it is too many mouse clicks for you or something), the obvious solution is to keep a copy of that in a text file and copy and paste it, or just create the basic main.cpp and copy the file to the project folder or new file name each time. It does not take a genius to think of that, just someone who knows how to operate a computer which should be a prerequisite for programming one I think!

      But to be honest, just type it in, it is less than a minutes work! You can make it even easier for yourself; if you are not using the argc/argv parameters (as here) just omit them.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.