added samples
[windows-sources.git] / sdk / samples / FrameworkSamples / CLR / WordCount / readme.htm
blob3544d6da3a359f9cdf3357c5883450a25f542350
1 <html><head><META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=utf-8" /><META NAME="save" CONTENT="history" /><title xmlns:mshelp="http://msdn.microsoft.com/mshelp" xmlns:msxsl="urn:schemas-microsoft-com:xslt">WordCount Application Sample</title><META NAME="Description" CONTENT="&#xD;&#xA; This sample shows how to create an application that opens multiple files and counts each file's bytes, characters, words, and lines. The results from each file and the total of all files are displayed.&#xD;&#xA; "></META><META NAME="MS.LOCALE" CONTENT="en-us" /><style>
2 body
3 {font-family:Verdana;font-size:medium;}
4 div#mainSection, div#header
5 {font-size:70%;width: 100%;}
6 div#mainBody
7 {font-size:90%;}
8 div#mainSection div table
9 {font-size: 100%;text-align: left;}
10 span#nsrTitle
11 {color:#003399;font-size:90%;font-weight:600;}
12 div#header
13 {background-color:#D4DFFF;}
14 .heading
15 {font-size:120%;color:#003399;}
16 .subHeading
17 {font-size:100%;margin-bottom:4;}
19 {margin-top:-2;margin-bottom:3;}
21 {margin-top:10;margin-bottom:5;}
22 div.tableSection p
23 {margin-top:1;margin-bottom:4;}
24 div#mainSection table th
25 {background-color:#EFEFF7;color:#000066;text-align:left;}
26 div#mainSection table td
27 {background-color:#F7F7FF;}
28 div#mainSection table
29 {margin-top:5px;margin-bottom: px;}
30 </style></head><body><div id="header"><table width="100%" id="topTable"></table></div><div id="mainSection"><div id="mainBody"><br /><font color="DarkGray">[This readme is a partial copy of the sample's topic in the SDK documentation.]</font><br /><font color="DarkGray" xmlns:mshelp="http://msdn.microsoft.com/mshelp" xmlns:msxsl="urn:schemas-microsoft-com:xslt"></font><p xmlns:mshelp="http://msdn.microsoft.com/mshelp" xmlns:msxsl="urn:schemas-microsoft-com:xslt"></p><div class="introduction"><p xmlns:mshelp="http://msdn.microsoft.com/mshelp" xmlns:msxsl="urn:schemas-microsoft-com:xslt">
31 This sample shows how to create an application that opens multiple files and counts each file's bytes, characters, words, and lines. The results from each file and the total of all files are displayed.
32 </p><p xmlns:mshelp="http://msdn.microsoft.com/mshelp" xmlns:msxsl="urn:schemas-microsoft-com:xslt">
33 For information about using the samples, see the following topics:
34 </p><ul xmlns:mshelp="http://msdn.microsoft.com/mshelp" xmlns:msxsl="urn:schemas-microsoft-com:xslt"><li><p><span sdata="link">How to: View and Download Samples</span></p></li><li><p><span sdata="link">How to: Set Sample Settings</span></p></li></ul></div><h3 class="procedureSubHeading" xmlns:mshelp="http://msdn.microsoft.com/mshelp" xmlns:msxsl="urn:schemas-microsoft-com:xslt">To build the sample using the command prompt</h3><div class="subSection"><ol xmlns:mshelp="http://msdn.microsoft.com/mshelp" xmlns:msxsl="urn:schemas-microsoft-com:xslt"><li><p>
35 Open the Command Prompt window and navigate to one of the language-specific subdirectories under the WordCount directory. For information about required settings and the SDK Command Prompt, see <span sdata="link">How to: Set Sample Settings</span>.
36 </p></li><li><p>
37 Type <span class="input">msbuild WordCountCS.sln</span> or <span class="input">msbuild WordCountVB.sln</span>, depending on your choice of programming language.
38 </p></li></ol></div><h3 class="procedureSubHeading" xmlns:mshelp="http://msdn.microsoft.com/mshelp" xmlns:msxsl="urn:schemas-microsoft-com:xslt">To build the sample using Visual Studio</h3><div class="subSection"><ol xmlns:mshelp="http://msdn.microsoft.com/mshelp" xmlns:msxsl="urn:schemas-microsoft-com:xslt"><li><p>
39 Open Windows Explorer and navigate to one of the language-specific subdirectories under the WordCount directory.
40 </p></li><li><p>
41 Double-click the <b>WordCountCS.sln</b> or <b>WordCountVB.sln file</b>, depending on your choice of programming language, to open the file in Visual Studio 2005.
42 </p></li><li><p>
43 On the <span class="ui">Build</span> menu, click <span class="ui">Build Solution</span>.
44 </p></li></ol></div><h3 class="procedureSubHeading" xmlns:mshelp="http://msdn.microsoft.com/mshelp" xmlns:msxsl="urn:schemas-microsoft-com:xslt">To run the sample</h3><div class="subSection"><ol xmlns:mshelp="http://msdn.microsoft.com/mshelp" xmlns:msxsl="urn:schemas-microsoft-com:xslt"><li><p>
45 In the Command Prompt window, navigate to the subdirectory that contains the <b>WordCount</b> application.
46 </p></li><li><p>
47 Type <span class="input">WordCount.exe [filename]</span> at the command prompt to count the words in a file.
48 </p></li><li><p>
49 The totals from each file are listed separately and the total of the results from all the files are displayed.
50 </p></li></ol></div><h1 class="heading" xmlns:mshelp="http://msdn.microsoft.com/mshelp" xmlns:msxsl="urn:schemas-microsoft-com:xslt"><span onclick="ExpandCollapse(sectionToggle0)" style="cursor:default;" onkeypress="ExpandCollapse_CheckKey(sectionToggle0, event)" tabindex="0">Remarks</span></h1><div id="sectionSection0" class="section"><p xmlns:mshelp="http://msdn.microsoft.com/mshelp" xmlns:msxsl="urn:schemas-microsoft-com:xslt">
51 The sample is a console application; you must run it from the command line to view its output.
52 </p><p xmlns:mshelp="http://msdn.microsoft.com/mshelp" xmlns:msxsl="urn:schemas-microsoft-com:xslt">
53 The sample uses the following technologies and classes:
54 </p><ul xmlns:mshelp="http://msdn.microsoft.com/mshelp" xmlns:msxsl="urn:schemas-microsoft-com:xslt"><li><p><b>I/O -</b></p><ul><li><p><b>FileStream - </b>Allows file access. This class is used to read to and write from files.
55 </p></li><li><p><b>StreamWriter - </b>Used with a FileStream instance to format text output to a file.
56 </p></li><li><p><b>StreamReader - </b>Used with a FileStream instance to read text from a file.
57 </p></li></ul></li><li><p><b>Collections -</b></p><ul><li><p><b>ArrayList - </b>Stores sets of objects.
58 </p></li><li><p><b>SortedList - </b>Stores sets of objects in a sorted manner.
59 </p></li><li><p><b>IEnumerator - </b>Enumerates over sets of objects.
60 </p></li><li><p><b>IDictionaryEnumerator - </b>Enumerates over indexed sets of objects.
61 </p></li></ul></li></ul></div><h1 class="heading" xmlns:mshelp="http://msdn.microsoft.com/mshelp" xmlns:msxsl="urn:schemas-microsoft-com:xslt"><span onclick="ExpandCollapse(seeAlsoToggle)" style="cursor:default;" onkeypress="ExpandCollapse_CheckKey(seeAlsoToggle, event)" tabindex="0">See Also</span></h1><div id="seeAlsoSection" class="section"><h4 class="subHeading" xmlns:mshelp="http://msdn.microsoft.com/mshelp" xmlns:msxsl="urn:schemas-microsoft-com:xslt">Concepts</h4><div class="seeAlsoStyle"><span sdata="link" xmlns:mshelp="http://msdn.microsoft.com/mshelp" xmlns:msxsl="urn:schemas-microsoft-com:xslt">.NET Framework Class Library Overview</span></div><h4 class="subHeading" xmlns:mshelp="http://msdn.microsoft.com/mshelp" xmlns:msxsl="urn:schemas-microsoft-com:xslt">Reference</h4><div class="seeAlsoStyle"><span sdata="cer" target="T:System.Collections.ArrayList" xmlns:mshelp="http://msdn.microsoft.com/mshelp" xmlns:msxsl="urn:schemas-microsoft-com:xslt">ArrayList</span></div><div class="seeAlsoStyle"><span sdata="cer" target="T:System.IO.FileStream" xmlns:mshelp="http://msdn.microsoft.com/mshelp" xmlns:msxsl="urn:schemas-microsoft-com:xslt">FileStream</span></div><div class="seeAlsoStyle"><span sdata="cer" target="T:System.Collections.IEnumerator" xmlns:mshelp="http://msdn.microsoft.com/mshelp" xmlns:msxsl="urn:schemas-microsoft-com:xslt">IEnumerator</span></div><div class="seeAlsoStyle"><span sdata="cer" target="T:System.Collections.IDictionaryEnumerator" xmlns:mshelp="http://msdn.microsoft.com/mshelp" xmlns:msxsl="urn:schemas-microsoft-com:xslt">IDictionaryEnumerator</span></div><div class="seeAlsoStyle"><span sdata="cer" target="T:System.Collections.SortedList" xmlns:mshelp="http://msdn.microsoft.com/mshelp" xmlns:msxsl="urn:schemas-microsoft-com:xslt">SortedList</span></div><div class="seeAlsoStyle"><span sdata="cer" target="T:System.IO.StreamReader" xmlns:mshelp="http://msdn.microsoft.com/mshelp" xmlns:msxsl="urn:schemas-microsoft-com:xslt">StreamReader</span></div><div class="seeAlsoStyle"><span sdata="cer" target="T:System.IO.StreamWriter" xmlns:mshelp="http://msdn.microsoft.com/mshelp" xmlns:msxsl="urn:schemas-microsoft-com:xslt">StreamWriter</span></div><div class="seeAlsoStyle"><span sdata="cer" target="N:System.Collections" xmlns:mshelp="http://msdn.microsoft.com/mshelp" xmlns:msxsl="urn:schemas-microsoft-com:xslt">System.Collections</span></div><div class="seeAlsoStyle"><span sdata="cer" target="N:System.IO" xmlns:mshelp="http://msdn.microsoft.com/mshelp" xmlns:msxsl="urn:schemas-microsoft-com:xslt">System.IO</span></div><h4 class="subHeading" xmlns:mshelp="http://msdn.microsoft.com/mshelp" xmlns:msxsl="urn:schemas-microsoft-com:xslt">Other Resources</h4><div class="seeAlsoStyle"><span sdata="link" xmlns:mshelp="http://msdn.microsoft.com/mshelp" xmlns:msxsl="urn:schemas-microsoft-com:xslt">Overview of the .NET Framework</span></div></div></div></div></body></html>