Skip to content

Instantly share code, notes, and snippets.

@Toltar
Created March 29, 2016 16:12
Show Gist options
  • Save Toltar/ebcfc0300bf5a6936cb1 to your computer and use it in GitHub Desktop.
Save Toltar/ebcfc0300bf5a6936cb1 to your computer and use it in GitHub Desktop.
THE HOLY USER INPUT BLANK STRING CHECK!!
int main()
{
char *buff;
size_t n;
size_t max = 40;
while(fgets(buff,max,stdin))
{
n = strlen(buff);
if( n==1 && buff[n-1] == '\n')
{
printf("Empty string\n");
break;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment