0

In a visual studio project it often happens to create several files and write a bunch of lines to include the necessary libraries / headers. I was wondering if it was possible to automate the process with a custom shortcut; for example, in my case, I would like to insert the following lines:

#define _CRT_SECURE_NO_WARNINGS
#include <stdlib.h>
#include <stdio.h>
#include <stdbool.h>
#include <string.h>

for example pressing CTRL+MAIUSC+M. Is that possible?

Mattia Monari
  • 158
  • 1
  • 3
  • 9
  • Why stop there? Have a default `int main(int argc, char *argv) { return 0; }` too, plus a commented heading, purpose, author, compiler version etc. Can you set up a template? What I do, is simply copy my standard base file into the project folder and rename it. – Weather Vane Jan 03 '21 at 19:09
  • Maybe a [code snippet](https://learn.microsoft.com/de-de/visualstudio/ide/walkthrough-creating-a-code-snippet) is sufficient? Otherwise an extension might be needed (but I never played around with these). – Werner Henze Jan 03 '21 at 19:09
  • @WernerHenze that's not exactly what i was looking for, but thanks because it is a valid alternative; i'm going to use that method until someone give me something more specific. – Mattia Monari Jan 03 '21 at 19:17
  • See https://stackoverflow.com/questions/47241777/how-can-i-type-0-more-quickly-in-visual-studio – Sergey Vlasov Jan 04 '21 at 04:54

0 Answers0