Author Topic: Create new Default Code  (Read 2672 times)

Offline crystoppher

  • Single posting newcomer
  • *
  • Posts: 4
Create new Default Code
« on: July 12, 2018, 04:33:23 pm »
Hey guys,
I'm having difficulty creating a new default code. I like to create a default code like this.

Example

  /⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆
   ⋆  Project: $(proejct)
   ⋆  Function:
   ⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆
   ⋆  $Author: mario $
   ⋆  $Name:  $
   ⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆
   ⋆
   ⋆  Copyright 2007 by company name
   ⋆
   ⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆/

I'm starting my studies in programming c. So I still have more questions about some topics.


Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: Create new Default Code
« Reply #1 on: July 13, 2018, 03:01:55 pm »
What should this be?
Default code for new project?
Default code for every new c file?
Default code for every new cpp file?
Shortcut to paste?
Template to easily add to the project?

Offline crystoppher

  • Single posting newcomer
  • *
  • Posts: 4
Re: Create new Default Code
« Reply #2 on: July 13, 2018, 07:02:07 pm »
Default code for every new c file? Yes! Exactly.
I wanted to create similar code and leave saved automatically. With each new project this information should appear without having to copy and paste this code.  Is this possible???

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: Create new Default Code
« Reply #3 on: July 15, 2018, 09:57:20 pm »
I assume you want that codeblocks replaces the $(proejct)  with the project title and  $Name:  $  with the file name?

There are multiple ways to do this.
The easiest way is this:
Settings->Editor->Default code
Add your default code there.
You can use variable expansion (http://wiki.codeblocks.org/index.php/Variable_expansion) in your default code. So for you this would look like this:
Code
 /**************************************************************************
   *  Project: $(PROJECT_NAME)
   *  Function:
   **************************************************************************
   *  $Author: mario $
   *  $Name:  $
   **************************************************************************
   *
   *  Copyright 2007 by company name
   *
   *************************************************************************/

To trigger this template you have to use the shortcut File->New->File->C/c++ source file->Go ecc...

Offline crystoppher

  • Single posting newcomer
  • *
  • Posts: 4
Re: Create new Default Code
« Reply #4 on: July 17, 2018, 10:22:28 pm »
Yep!
Thanks for help. @BlueHazzard