0

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

#define edl '\n'
2
  • Welcome to SO! I think you could improve your chances of getting an answer if you review the how to ask and modify your question. Commented Feb 12, 2020 at 4:17
  • To clarify, as @HelloChen had in his snippet, use '\\n' to insert a literal '\n' into your output. So "#define edl '\\n'", Commented Feb 12, 2020 at 4:44

2 Answers 2

1
"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"
    },
Sign up to request clarification or add additional context in comments.

Comments

0

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"
}

}

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.