Obviously I am a noob, and just trying to get a grasp on C. I wrote the following, thinking it would be simple, but it truncates the output, and I cannot see why.
When I run it:Code:#include <stdio.h> int main() { char dummy[80]; printf("Enter a string:\n"); scanf("%[^a]",dummy); printf("%s\n",dummy); return 0; }
$ ./a.out
Enter a string:
This is a test
This is
$
Where am i going wrong?
thanks