M
Mike
Hi,
I have some code that contains the line:
scanf("%[^\t\n]s", string);
to read a string containing white spaces.
When tested in a simple program:
#include <stdio.h>
int main()
{
char string[10];
scanf("%[^\t\n]s", string);
printf("%s\n", string);
return 0;
}
it works fine however when written into a part of a larger program I am
writing it's as if I've missed out the line and compiler skips over it.
Stepping through it, it is getting called and wrapping it up i printf()
confirms this.
Snippet of code before and after:
printf("Enter data:\n");
for (i=0; i<=A.Rows; i++)
{
scanf("%[^\t\n]s", string);
for (j=0; j<20; j++)
{
/*Extra code in here*/
}
}
Any ideas?
Thanks,
I have some code that contains the line:
scanf("%[^\t\n]s", string);
to read a string containing white spaces.
When tested in a simple program:
#include <stdio.h>
int main()
{
char string[10];
scanf("%[^\t\n]s", string);
printf("%s\n", string);
return 0;
}
it works fine however when written into a part of a larger program I am
writing it's as if I've missed out the line and compiler skips over it.
Stepping through it, it is getting called and wrapping it up i printf()
confirms this.
Snippet of code before and after:
printf("Enter data:\n");
for (i=0; i<=A.Rows; i++)
{
scanf("%[^\t\n]s", string);
for (j=0; j<20; j++)
{
/*Extra code in here*/
}
}
Any ideas?
Thanks,