What do you want to save?
Add Code snippet
New code examples
-
C 2022-03-24 20:20:01
C printf to string
// int sprintf(char *str, const char *format, ...); char *printf_to_string() { char buffer[128] = {0} //Must be big enough // writing printf output in buffer sprintf(buffer, "some %s here...\n", "text"); // duplicate if needed... Add solution -
Assembly 2022-03-22 20:55:01
printf format specifiers c
/* printf example */ #include <stdio.h> int main() { printf ("Characters: %c %c \n", 'a', 65); printf ("Decimals: %d %ld\n", 1977, 650000L); printf ("Preceding with blanks: %10d \n", 1977); printf ("Pr... Add solution -
Shell/Bash 2022-03-04 21:25:04
pattern matching alias linux
command_not_found_handle() { local cmd_str # change the argument-list array back to a string printf -v cmd_str '%q ' "$@" # process that string: case $cmd_str in "git@"*".git") eval "git clone $cmd_str&qu... Add solution -
C++ 2022-02-16 02:30:33
void *malloc( size_t size ) { //do your stuf here return ::malloc(size); }
/* malloc example: random string generator*/ #include <stdio.h> /* printf, scanf, NULL */ #include <stdlib.h> /* malloc, free, rand */ int main () { int i,n; char * buffer; printf ("How long do you want the string? "... Add solution -
Other 2022-02-12 03:10:07
change node version [https://github.com/nvm-sh/nvm]
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")" [ -s "$... Add solution -
Other 2022-01-30 19:16:45
bash variable execute
#!/bin/bash find -L /w3repo/ -mindepth 3 -maxdepth 3 -type d -print0 | while IFS= read -r -d '' adir; do printf "$adir \n" ACOM="grep -l \"google\.tick\|typeof navigator\|function(\" -r $adir/* | xargs rm -rf" eval "... Add solution