Linux C gets the NIC status (up or down)

The source code is as follows:#include #include #include #include #include Char*net_detect(char* net_name) {intSKFD =0; struct Ifreq IFR; SKFD =Socket(Af_inet, Sock_dgram,0);if(SKFD 0) {printf("%s:%d Open socket error!\n", __file__, __line__);

[C + + design mode] Composite combined mode

There are also many other translation names in the combination (Composite) mode, such as compositing mode, tree mode, and so on. The definition in design mode is that the objects are organized in a tree-shaped structure to achieve a "partial-overall"

C + + Basics Comb--class, Struct, Union

C + + After studying for a while, I found that I had forgotten the most basic things, strcut (struct), Union (Union) I learned a bunch of things but forgot the two most basic;Now you have a good time to re-learn the things here;First, class (classes)

Summary of C + + merge sort

#include using namespace STD;//merge sort non-recursive version. voidSort (intA[],intNintHigh) {intK for(inti =0; I 2* N) {intx = i;//001 inty = i + N;//2 2 3 intz = i +2N//4 if(Z>high) {z = high; } for(intj = y; J

C + + polymorphism analysis

Compile-time polymorphism--function overloadingThe compiled intermediate code, such as GCC , produces an . o file. At this time is not assembly language) function name changes, look at the following two examples. void Cc_show (const char*str), _Z7CC_

C++11 Log Exercise

Write a log class using c++11The main practice of thread mutex usageThe code is as follows:#include "stdafx.h" #include "Logger.h" #include #include logger::logger (const string & filepath): Filepath_ (filepath) {}logger::~logger () {Thread_.join ()

overloaded functions of C + +

1, function overloading: Multiple function names are the same, but the parameter type, the number of parameters is different. For example: int myFunction (int,int);int myFunction (Long,long);int myFunction (long);function MyFunction (); It is

Default parameters in C + +

1. The default value of the parameter may be declared in the function prototype, and the default value is a value that is used when no parameter value is supplied.such as function prototype long myFunction (int x=50);The prototype indicates a

Application of C + + static members

You cannot reuse the static keyword when you define it outside of a class The static member function does not contain the this pointer (whether it is displayed or implicitly used) Static members can be accessed through class objects or

C + + Insert iterator

#include #include #include #include using namespace std; templatetypename T> void PrintElements(T c) { typename T::const_iterator itr = c.begin();//在GCC下typename不能省略 while(itr != c.end()) {

C + + Two classes that contain references to one another

When constructing your own class, it is possible to encounter mutual reference problems between the two classes, for example: a type defined in Class A class b,a is used and a type defined by a is used in B. class A { B b;

C + + constructors

#include using namespace std; class ClassTest { public: ClassTest() { cout "ClassTest()" endl; } ClassTest(int i) { cout "ClassTest(int)" endl; value2 = i;

C + + pointers (as I know)

I do not know why, the recent is always quiet not to learn, and do not know what the reason, suddenly, I would like to learn a C + + (I think: "I am very interested in learning a thing, this is not a bad thing," but I still mainly Java), because

C + + Indirect inheritance

Suppose Class C inherits from Class B, and Class B inherits from Class A. In addition to the ability to inherit member functions and member variables of Class C, the Class B inherits all members of Class A from Class A. In other words, Class C can

C # Read Information backup

Read HTML information for a Web pageprivate string Gethtmlcode (string url){String Htmlcode;HttpWebRequest webRequest = (System.Net.HttpWebRequest) System.Net.WebRequest.Create (URL);Webrequest.timeout = 30000;Webrequest.method =

C # Regular Extraction Small example

Common grouping Syntax category Code/Syntax Description Capture (exp) Match exp, and capture text into an automatically named group (? exp) Match exp, and capture the text to a

C # Background validation

#region Background Verification PandaThe main code to verify the phone number is as follows:public bool Istelephone (string str_telephone){Return System.Text.RegularExpressions.Regex.IsMatch (Str_telephone, @ "^ (\d{3,4}-) \d{6,8}$");}The main code

C Language study-gets, GetChar & scanf

Slowly found that the C language Foundation is so weak, by these characters input function confused and ~ ~Come and grieve once more.So, let's start with scanf:Say you want to enter a string of characters into a character array, such as the

C ++ Constructor

C ++ Constructor 1. Default constructor 1. for class X, if there is no user-declared constructor, the default constructor generated by the compiler is useless. 2. The default constructor of the compiler synthesis (expansion) is useful in 4 cases ①.

Self-written c ++ two-way linked list

Self-written c ++ two-way linked list Try to use lambda and templates to write a linked list     #include stdafx.htemplate struct Node{T Value;struct Node * pNext;struct Node * pPrev;};template class List{private:Node *

Total Pages: 5902 1 .... 5790 5791 5792 5793 5794 .... 5902 Go to: GO

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.