monty singh
monty singh

Reputation: 59

How to literally add newline character in vscode cpp snippet?

How can I add the following line to the body of my vs code CPP snippet?

#define edl '\n'

Upvotes: 0

Views: 1749

Answers (2)

Sourin Mukherjee
Sourin Mukherjee

Reputation: 1

I can clearly understand your problem , just copy and paste and don't forget to rate and vote

{ // Place your snippets for c here. Each snippet is defined under a snippet name and has a prefix, body and // description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are: // $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the // same ids are connected. // Example: "Print to console": { "prefix": "jeetC", "body": [

        "#include <stdio.h>",
        "#include <conio.h>",
        "#include <math.h>",
        "#include <string.h>",
        "#include <stdlib.h>",
        
        "\n",
        "int main()",
        "{   $2 ",
        "   printf(\"\\n\");",
        "   printf(\"\\n\");",
        "return 0;",
    "}",

    ],
    "description": "Log output to console"
}

}

Upvotes: 0

Keene Chen
Keene Chen

Reputation: 11

"Print to #include <stdio.h>":{
        "scope": "c,cpp",
        "prefix": "std",
        "body": [
        "/* Hello Chen C program */",
        "#include <stdio.h>",
        "#include <stdlib.h>\n",
        "int main(void)",
        "{",
        "    ${1:printf(\"${2:Hello Chen\\n}\");}",
        "    ${3:system(\"pause\");}",
        "}",
        ],
        "description": "stdio.h"
    },

Upvotes: 1

Related Questions