Skip to content

Instantly share code, notes, and snippets.

@Silva97
Last active November 3, 2022 13:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Silva97/639a5213ce89f92ca05066414bb6d555 to your computer and use it in GitHub Desktop.
Save Silva97/639a5213ce89f92ca05066414bb6d555 to your computer and use it in GitHub Desktop.
/********************
* Exemplo desenvolvido por Luiz Felipe
* Link do vídeo: https://youtu.be/wUrk9AK6ItY
********************/
#include <stdio.h>
char keyboard[BUFSIZ];
void getinput(char *buff, int size);
int main(){
char text1[6], text2[11];
setbuf(stdin, keyboard);
scanf("%5[^\n]s", text1);
getinput(text2, 10);
printf("text1 = %s\n", text1);
printf("text2 = %s\n", text2);
return 0;
}
void getinput(char *buff, int size){
setbuf(stdin, keyboard);
fgets(buff, size, stdin);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment