fscanf is a C function designed to read character by character from a file to the system
how we can use scanf programmatically to read till first white space ????

:) :)

Recommended Answers

All 5 Replies

If you don't expect the first character to actually be whitespace, you can use "%*s". Otherwise, because %s ignores leading whitespace, you would need to use an exclusion scanset of whitespace:

fscanf ( in, "%*[^ \n\t\r\f\v]" );

Thank you very much You are so cute helping me
I talke to Professor and he allowed to use C++ streams

>You are so cute helping me
...

>I talke to Professor and he allowed to use C++ streams
So are you asking how to do it in with iostreams or is the question moot now?

the question is moot now , thank you very mush for your care

If you don't expect the first character to actually be whitespace, you can use "%*s". Otherwise, because %s ignores leading whitespace, you would need to use an exclusion scanset of whitespace:

fscanf ( in, "%*[^ \n\t\r\f\v]" );

>You are so cute helping me
...

>I talke to Professor and he allowed to use C++ streams
So are you asking how to do it in with iostreams or is the question moot now?

the question is moot now , thank you very mush for your care

I used the streams of the C++ that is much easier
Thank you very much Narue

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.