Fscanf (FD, "% * [^/n]");

Source: Internet
Author: User

How to explain fscanf (FD, "% * [^/n]")

 

Posted on:2007-11-23 16:09:071Floor score:40
"% [^/N]" indicates to read the input string until the character '/N' is met. ^ indicates no.
Modify Delete Report Reference Reply

Add as a friend

Send private message

Online Chat
  • Mu_yang
  • Muyang
  • Level:
Posted on:2007-11-23 18:13:402Floor score:20
* Indicates that the system jumps over and does not process or convert the read data. In this way, no corresponding pointer is required, occupying meaningless memory.
Modify Delete Report Reference Reply

Add as a friend

Send private message

Online Chat
  • Yao_zhuang
  • QianYu
  • Level:
Posted on:2007-11-23 21:01:143Floor score:0
I have never known that there are regular expressions in C.
Modify Delete Report Reference Reply

Add as a friend

Send private message

Online Chat
  • Xhd3767
  • Idiot
  • Level:
Posted on:2007-11-23 21:57:114Floor score:0
Taught !!
Modify Delete Report Reference Reply

Add as a friend

Send private message

Online Chat
  • Zhulinpptor
  • Zhulin
  • Level:
Posted on:2007-11-25 05:10:435Floor score:10
Sscanf is a useful function that can be used to retrieve integers, floating-point numbers, and strings from strings. It is easy to use, especially for integers and floating-point numbers. However, beginners may not know some advanced usage when processing strings. Here is a brief description.

1. Common usage.

The following is a reference clip:
Char STR [512] = {0 };
Sscanf ("123456", "% s", STR );
Printf ("str = % s/n", STR );

2. Take a string of the specified length. In the following example, a string with a maximum length of 4 bytes is obtained.

The following is a reference clip:
Sscanf ("123456", "% 4 s", STR );
Printf ("str = % s/n", STR );

3. Obtain the string of the specified character. For example, in the following example, the string is obtained when a space is encountered.

The following is a reference clip:
Sscanf ("123456 abcdedf", "% [^]", STR );
Printf ("str = % s/n", STR );

4. Take a string that only contains the specified character set. For example, in the following example, take a string that only contains 1 to 9 letters and lowercase letters.

The following is a reference clip:
Sscanf ("123456 abcdedfbcdef", "% [1-9a-z]", STR );
Printf ("str = % s/n", STR );

5. Obtain the string of the specified character set. For example, in the following example, a string with uppercase letters is used.

The following is a reference clip:
Sscanf ("123456 abcdedfbcdef", "% [^A-Z]", STR );
Printf ("str = % s/n", STR );

Conversion http://dev.yesky.com/

Modify Delete Report Reference Reply

Add as a friend

Send private message

Online Chat
  • Superdin1_ur520
  • Dinosaurs
  • Level:
Posted on:2007-11-26 00:30:276Floor score:0
Leave a mark...
Modify Delete Report Reference Reply

Add as a friend

Send private message

Online Chat
  • Abandon156
  • Level:
Posted on:2007-11-26 03:31:467Floor score:0
I don't understand either of them...
Taught ..
I tested it myself... does it mean reading specific things?
Hope you can answer this question in detail...
Thank you ..
Modify Delete Report Reference Reply

Add as a friend

Send private message

Online Chat
  • Zxq80
  • Overflight Time and Space
  • Level:
Posted on:2007-11-26 10:32:398Floor score:40

Sacnf (Format String input)
Related functions: fscanf and snprintf

Header file # include <stdio. h>

Define the function int scanf (const char * format ,.......);

Function Description scanf () converts and formats the input data according to the format string. The common format of scanf () format conversion is as follows:
% [*] [Size] [l] [H] Type
Parameters enclosed in parentheses are optional parameters, while % and type are necessary.
* Indicates that the corresponding parameter data is ignored and not saved.
Size indicates the length of data that can be input.
L The input data values are saved in the long Int or double type.
H. The input data values are saved in the short int type.
Below we will introduce several types
The data entered by % d is converted into a signed decimal number (INT ).
% I the input data is converted into a signed decimal number. If the input data starts with "0x" or "0x", it indicates that the hexadecimal number is converted, if it starts with "0", it is converted to an octal number. Otherwise, it indicates decimal.
The data entered by % 0 is converted into an unsigned octal number.
The data entered by % u is converted into an unsigned positive integer.
The data entered by % x is an unsigned hexadecimal number, which is converted and stored in the unsigned int type variable.
% X is the same as % x
% F indicates a signed floating point number, which is converted and stored in a float variable.
% E is the same as % F
% E is the same as % F
% G is the same as % F
The % s input data is a string ending with a space character.
% C the input data is a single character.
[] Read data, but only characters in parentheses are allowed. For example, [A-Z].
[^] The character after the ^ symbol that reads data but does not allow brackets, for example, [^ 0-9].

If the return value is successful, the number of parameters is returned. If the return value fails,-1 is returned. The error cause is stored in errno.

Modify Delete Report Reference Reply

Add as a friend

Send private message

Online Chat
  • Himyhuang
  • Yellow Crane Tower
  • Level:
Posted on:2007-12-18 23:26:569Floor score:0
Good.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.