Click here to Skip to main content
15,938,848 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
char chTitle[MAX_PATH];
scanf("%[^\t\n]s", &chTitle);

above code not working....scanf is just skipping.... any clue...I want to read string with space in chTitle
Member 2954534 4-Dec-12 3:15am    
What exactly do you mean by "scanf is just skipping"? Doesn't it let you enter characters? Isn't there anything in chTitle?

scanf format specifiers don't support regular expressions (or whatever you wrote), see the documentation[^].
Share this answer
See here[^], scanf() format specifications do not take regular expressions.
Share this answer
Member 2954534 4-Dec-12 4:12am    
That isn't meant to be a regular expression. See here: It's a delimiter list.
What about
Share this answer
In addition to solution 1 you must not use the '&' with chTitle. scanf expects char *, not char **. At least my gcc complains when I use the '&'.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900