27 lines
438 B
C
27 lines
438 B
C
#include <stdio.h>
|
|
#include <string.h>
|
|
#include <stdlib.h>
|
|
int main()
|
|
{
|
|
char note[32];
|
|
char cmd[42];
|
|
char c;
|
|
printf("a -add \n v -view\n");
|
|
system("/bin/stty raw");//remove enter
|
|
c = getc(stdin);
|
|
system("/bin/stty cooked");
|
|
if (c == 'a')
|
|
{
|
|
fgets(note,32,stdin);
|
|
printf("you wrote: %s", note);
|
|
snprintf(cmd,sizeof(cmd),"dnote add %s",note);
|
|
}
|
|
if (c == 'v')
|
|
{
|
|
snprintf(cmd,sizeof(cmd),"dnote view");
|
|
}
|
|
system(cmd);
|
|
|
|
return 0;
|
|
}
|