User forums > Help

Create new Default Code

(1/1)

crystoppher:
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.

BlueHazzard:
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?

crystoppher:
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???

BlueHazzard:
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
   *
   *************************************************************************/

--- End code ---

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

crystoppher:
Yep!
Thanks for help. @BlueHazzard

Navigation

[0] Message Index

Go to full version