說起來很有意思,自認為對C語言理解得還是比較深刻的。但居然到今天才知道有個strtok函數,試用了一下突然感慨以前做了多少重複勞動。每次需要解析設定檔,每次需要分割字串,居然都是自己去分割字串,既累人又容易出錯。感概繼續學得不夠全面啊!這裡引用一段strtok用法:The strtok() function returns a pointer to the next "token" in str1, where str2 contains the delimiters that
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading;namespace Test{ class TestThread { private static void ThreadFuncOne() { for (int i = 0; i < 150; i++)
具體源碼如下:<轉載> 一、使用API函數mciSendString構成的媒體播放類。 程式碼 using System; using System.Runtime.InteropServices; using System.Text; using System.IO ; namespace clsMCIPlay { /// <SUMMARY>
有一個檔案名稱為num.txt的文字檔,裡面有1千萬個隨機數,這些數位大小在0~1億之間,儲存方式如下: Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->542223223232454345232676575.......要求:1.寫一個程式來讀取這個檔案中的數字,並從大到小排序後以上面的格式儲存為 num_b.txt2.記憶體佔用不可超過1MB
參考:Select XML Nodes by Name假設xml檔案內容是<?xml version="1.0" encoding="utf-8"?><Workflow> <Activity> <ActivityId>1</ActivityId> <ActivityName>start</ActivityName>
const是常量,readonly是唯讀,“部落格園er”都知道:)那麼他們的區別是什麼那?個人總結如下:一、賦值1)const修飾的變數在定義時必須賦初值,其他位置不容許改變變數值;2)readonly修飾的變數可以在定義時賦值也可以在建構函式中賦值,其他位置不容許改變變數值。二、調用1)const修飾的變數需要用類名來調用如同static成員一樣。2)readonly修飾的變數需要用對象來調用。三、代碼例:public class ConstReadOnly {