Share a Linux CProgramHow to read the configuration file
When your configuration file is like
Key1 = value1# This is a commentKey2 = value2
Type file,It is really very simple and fast.Assume that your configuration file name is/path/to/file/
server:
#- *-coding: cp936-*-import socket, selects = socket. socket () host = socket. gethostname () # Get the host name Port = 5000 # specify the port number S. BIND (host, Port) # bind the port number and host name together S. listen (5) #
Bitwise operators include: & (bitwise AND), | (bitwise OR), ^ (bitwise OR), and ),~ (Bitwise inversion ).
The priority ranges from high to low ~ , &, ^, |.
Bitwise AND computation have two typical usage: ① take a bit of the information of a single
1. Obtain the time:Use the time () function to obtain the Calendar Time. Its prototype is time_t time (time_t * timer );
# Include "stdafx. h"# Include "time. h"# Include "stdio. h"# Include "stdlib. h"
Int main (void){Struct tm t; // defines the tm
---------
How to Use the H and C files? In general, the H file is declare (Declaration), and the C file is define (Definition ). Because C files need to be compiled into library files (in Windows, yes. obj /. lib, which is in UNIX. o /. a) if
$ Vim Hello. c
# Include
Int main (void){Printf ("Hello world! /N ");Return 0;}
: The wq storage disk is Hello. c.
Enter gcc Hello. c-o hello in the command line (case sensitive)
The following warning may be reported during compilation:
I found that I could not write a blog. Someone should have said that, why not? Don't you write anything you want? Well, I know this, But blog writing is also skillful. Some blogs give high comments, but some of them are unattended. I have summarized
Quick Sorting Algorithm
Region name
Quick sorting is an improvement of Bubble sorting. Its basic idea is: Split the data to be sorted into two independent parts by means of a lie-down sorting, and all the data in one part is smaller than all the
This article takes SQL Server2000 as an example. The example database is china and the table is test to describe how to use SQL stored procedures in C.
I. SQL statement for creating the test table:
Create table test55(Uid int identity (1, 1 ),Class1
Master of C ++ Stan Lippman: My advice to Chinese programmers
Author:Www.aspcool.comTime: 2004-9-20 18:07:29
Founder of C ++, Stan. stan Lippman attended the Microsoft technology
Generally, only the Application can use the custom IConfigurationSectionHandler interface class to read the configuration in app. config.
Only two steps are required:
Step 1: Define a class in your application:
Public class
Parse the webpage with IE WebControl to get specific data in the specific webpage: Set oDocument = Form2.m _ IE. Document
Set oelement = oDocument. Forms ("searchdetail ")
Set oListTableElement = oelement. children (0 ). the advantage of children (0
Toupper, tolowerWe all know that C ++'s string does not have toupper. Fortunately, this is not a big problem, because we have STL algorithms:
String s ("heLLo ");Transform (s. begin (), s. end (), s. begin (), toupper );Cout Transform (s. begin (),
DistanceMost of the time, we want to locate a value in a vector, list, or something else. At this time, find cannot help, and someone will turn to a hand-written loop, it is also the Original Handwriting cycle:For (INT I = 0; I If (vect [I] = value)
MinGW already supports gcc 4.5, which is the most complete compiler currently supporting C ++ 0x. I used it to write some interesting projects.
However, this release does not fully support the C ++ standard thread library of gcc. After reading some
Defined header file:
Class girl is defined as a virtual base class. This will disable the generation of base class girl objects. At the same time, constructor: constructor without parameters girl (), with Parameters
Number constructor girl (string
In a program with exceptions, the exit of the function becomes elusive, which everyone knows. However, in many cases, we want the function to do something before exiting. in Java, we use try... finally, we will do this. In C ++, We have RAII.
Chatting with an undergraduate student a few days ago, he has been complaining that he has learned too much theoretical knowledge and has too few practical opportunities. I am worried that it may be difficult to find a job after graduation. I think
The following code specifications include precautions for program layout, comments, naming, readability, variables, program efficiency, quality assurance, code compilation, code testing, and version control.
I. Layout:
1. Add spaces between keywords
When I made a fast money interface, I encountered a problem that. net RSA encryption could not run normally on a win2008 server. After I changed to Win2003 server, the problem occurred, as shown below:
"/" Indicates a server error in the
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