Time of Update: 2018-12-06
用C語言編寫CGI程式 一、CGI概述 CGI(公用網關介面)規定了Web伺服器調用其他可執行程式(CGI程式)的介面協議標準。Web伺服器通過調用CGI程式實現和Web瀏覽器的互動,也就是CGI程式接受Web瀏覽器發送給Web伺服器的資訊,進行處理,
Time of Update: 2018-12-06
#include <stdio.h> #include "cgic.h " #include <string.h> #include <stdlib.h> test1.cgi int cgiMain() { char username[25]= "uuuu "; char pass[25] = "123 "; //printf(
Time of Update: 2018-12-06
/* packet handler */int xhttpd_packet_handler(CONN *conn, CB_DATA *packet){ char buf[HTTP_BUF_SIZE], file[HTTP_PATH_MAX], line[HTTP_PATH_MAX], *host = NULL, *mime = NULL, *home = NULL, *pp = NULL, *p = NULL, *end = NULL, *root = NULL,
Time of Update: 2018-12-06
/////////////////////////////////////////////////////////////////////////////////////multi_thread_server.c/////////////////////////////////////////////////////////////////////////////////////本檔案是多線程並發伺服器的代碼#include <netinet/in.h> // for
Time of Update: 2018-12-06
13.1C語言檔案1,兩種檔案存取方式(輸入,輸出方式)順序存取直接存取2,資料的兩種存放形式文字檔二進位檔案 13.2檔案指標定義檔案類型指標變數的一般形式:FILE *指標變數名;例如:FILE *fp1,*fp2; 13.3開啟檔案在使用檔案之前,需開啟檔案.在C裡使用fopen函數開啟檔案.格式為:fopen(檔案名稱,檔案使用方式);此函數返回一個指向FILE類型的指標.如:FILE
Time of Update: 2018-12-06
bool DealFile(string fileName) //隨便寫個函數說明{FILE *file;DWORD fileSize ,pos;int readLen ;//MAX_BUFFER_LEN 在標頭檔裡定義,這裡能夠保證資料不丟失,也不至於記憶體逸出char *buffer = new char[MAX_BUFFER_LEN]; file = fopen(fileName.c_str(),"r+b"); if(file == NULL) return
Time of Update: 2018-12-06
此執行個體是用戶端向伺服器端傳送檔案伺服器端代碼實現:#include <stdio.h>#include <stdlib.h>#include <string.h>#include <sys/types.h>#include <sys/socket.h>#include <sys/stat.h>#include <unistd.h>#include <arpa/inet.h>#include
Time of Update: 2018-12-06
http://topic.csdn.net/u/20090713/07/e5dab5e9-c8e2-4fba-89c9-6cc523516117.html?54480using System;using System.Collections;using System.ComponentModel;using System.Data;using System.Drawing;using System.Drawing.Drawing2D;using
Time of Update: 2018-12-06
此執行個體是用戶端向伺服器端下載檔案:伺服器端代碼實現:#include <stdio.h>#include <stdlib.h>#include <string.h>#include <sys/types.h>#include <sys/socket.h>#include <sys/stat.h>#include <unistd.h>#include <arpa/inet.h>#include
Time of Update: 2018-12-06
首先看一下程式碼:/* server.c */#include <stdio.h>#include <winsock2.h> /* for socket */#include <time.h> /* for clock(); */#define LISTEN_PORT 5500 /* listening port */#pragma comment(lib, "ws2_32.lib")
Time of Update: 2018-12-06
很多人認為C語言中的痛點是指標,對指標的理解直接關係到所編程式的好壞,所以, 在這裡列舉了一些C編譯器通常都有的標準函數的原始碼,看過它們,就能對指標和字串 有所瞭解了.1. strlen(),計算字串長度 int strlen(const char string) { int i=0; while(string[i]) i++; return i; } 2. strcpy(), 字串拷貝. char *strcpy(char *destination, const char *source)
Time of Update: 2018-12-06
using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;using System.Runtime.InteropServices;namespace WindowsFormsApplication24{
Time of Update: 2018-12-06
我先來了。首先mshtml很有用,對於html元素的解析很強大。比如:using mshtml;private string ConvertToAbsoluteUrls(string html, Uri relativeLocation, HtmlTag _htmlTag){IHTMLDocument2 doc = new HTMLDocumentClass();doc.write(new object[] { html });doc.close();string b =
Time of Update: 2018-12-06
Socket編程執行個體 代碼執行個體中的伺服器通過socket串連向用戶端發送字串"Hello, you are connected!"。只要在伺服器上運行該伺服器軟體,在用戶端運行客戶軟體,用戶端就會收到該字串。 該伺服器軟體代碼如下:#include <stdio.h>#include <stdlib.h>#include <errno.h>#include <string.h>#include <sys/types.h>
Time of Update: 2018-12-06
#include <QtGui/QApplication>#include "mainwindow.h"#include <QMessagebox>class CB{public: virtual void OutString(const char* str="CB:Outstring") { QMessageBox::information(NULL, "EnQStrXml", "Call CB::Outstring(...)");
Time of Update: 2018-12-06
C語言字串函數大全函數名: stpcpy功 能: 拷貝一個字串到另一個用 法: char *stpcpy(char *destin, char *source);程式例:#include <stdio.h>#include <string.h>int main(void){ char string[10]; char *str1 = "abcdefghi"; stpcpy(string, str1); printf("%s\n", string);
Time of Update: 2018-12-06
C和C++語言學習總結(資料來自<高品質C++/C 編程指南> 林銳博士 2001 年7
Time of Update: 2018-12-06
c# socket傳送大檔案using System;using System.Threading;using System.Net;namespace FileSender{ class Program { static void Main(string[] args) { string file = Console.ReadLine(); IPEndPoint ip = new
Time of Update: 2018-12-06
public static bool SplitFile(string SourceFile,int nNoofFiles){bool Split = false;try{FileStream fs = new FileStream(SourceFile, FileMode.Open, FileAccess.Read);int SizeofEachFile = (int)Math.Ceiling((double)fs.Length / nNoofFiles);for (int i = 0; i
Time of Update: 2018-12-06
伺服器端:int sock(){int port=7777;struct sockaddr_in sin;struct sockaddr_in pin;int sock_fp;int temp_sock_fp;int size_of_addr;char *msg="hello internet!"char buff[2561];sock_fp =