Thread: Whats going on here?

  1. #1
    Registered User
    Join Date
    Mar 2018

    Whats going on here?

    I need help interpreting fscanf(fptr,"%*[^\n]"); this part of the code. I dont undertand how the output could be obtained. Thanks.

    Whats going on here?-capture-png

  2. #2
    Registered User
    Join Date
    Apr 2018
    "%*[^\n]" instructs fscanf to read and discard a sequence of characters of any length, until a newline is encountered or there is nothing left to read. If a newline is read, fscanf returns and the newline is pushed back onto the stream, to be considered by a following read on the same stream.

    The asterisk *, or assignment suppression character, instructs fscanf to simply read any data matching the current specification from the stream and discard it, without storing it in any object.

    The [^\n] specification describes a scanset which matches a sequence of characters that contains one or more characters that are not the newline character. The brackets [] delimit the scanset, the presence of a circumflex ^ as the first character indicates inversionĀ—to match all characters which are not in the set rather than characters which are, and the newline character \n is the entire list of characters contained within the set.

    Take the time to read the documentation for fscanf if you get the chance, you can do a search on the Web, or better yet have a read of Appendix B1.3 of “The C Programming Language (Second Edition)” by Kernighan and Ritchie.

    Does that help?
    Last edited by stillmotion; 05-07-2018 at 10:45 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. ok so whats up with this???
    By Shaggy_ in forum Windows Programming
    Replies: 7
    Last Post: 07-02-2008, 11:04 AM
  2. Ok whats going on?
    By Thantos in forum A Brief History of
    Replies: 4
    Last Post: 10-25-2004, 02:41 PM
  3. whats in a name!!!
    By vasanth in forum A Brief History of
    Replies: 15
    Last Post: 04-20-2003, 11:31 AM
  4. Whats the fastest api for 2d and whats the best for 3d?
    By Josh Kasten in forum C++ Programming
    Replies: 5
    Last Post: 01-09-2003, 09:48 PM
  5. C#: Whats bad really?
    By MovingFulcrum in forum A Brief History of
    Replies: 29
    Last Post: 05-05-2002, 03:14 AM

Tags for this Thread