'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'
Solution 1:[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"
},
Solution 2:[2]
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"
}
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | rioV8 |
| Solution 2 | Sourin Mukherjee |
