| 1 | |
|---|
| 2 | <!DOCTYPE html |
|---|
| 3 | PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
|---|
| 4 | <html> |
|---|
| 5 | <head> |
|---|
| 6 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
|---|
| 7 | |
|---|
| 8 | <!-- |
|---|
| 9 | This HTML is auto-generated from an M-file. |
|---|
| 10 | To make changes, update the M-file and republish this document. |
|---|
| 11 | --> |
|---|
| 12 | <title>readFromIniFile</title> |
|---|
| 13 | <meta name="generator" content="MATLAB 7.7"> |
|---|
| 14 | <meta name="date" content="2008-11-05"> |
|---|
| 15 | <meta name="m-file" content="script_readFromIniFile"> |
|---|
| 16 | <link type="text/css" rel="stylesheet" href="../../style.css"> |
|---|
| 17 | </head> |
|---|
| 18 | <body> |
|---|
| 19 | <p class="header">RWTH - Mindstorms NXT Toolbox</p> |
|---|
| 20 | <div class="content"> |
|---|
| 21 | <h1>readFromIniFile</h1> |
|---|
| 22 | <!--introduction--> |
|---|
| 23 | <p>Reads parameters from a configuration file (usually *.ini)</p> |
|---|
| 24 | <!--/introduction--> |
|---|
| 25 | <h2>Contents</h2> |
|---|
| 26 | <div> |
|---|
| 27 | <ul> |
|---|
| 28 | <li><a href="#2">Syntax</a></li> |
|---|
| 29 | <li><a href="#4">Description</a></li> |
|---|
| 30 | <li><a href="#11">Examples:</a></li> |
|---|
| 31 | <li><a href="#17">See also</a></li> |
|---|
| 32 | <li><a href="#20">Signature</a></li> |
|---|
| 33 | </ul> |
|---|
| 34 | </div> |
|---|
| 35 | <h2>Syntax<a name="2"></a></h2> |
|---|
| 36 | <p><tt>ret = readFromIniFile(AppName, KeyName, filename)</tt></p> |
|---|
| 37 | <h2>Description<a name="4"></a></h2> |
|---|
| 38 | <p>ret=readFromIniFile(AppName, KeyName, filename)</p> |
|---|
| 39 | <p>This function works like GetPrivateProfileString() from the Windows-API that is well known for reading ini-file data. The |
|---|
| 40 | parameters are: |
|---|
| 41 | </p> |
|---|
| 42 | <p>AppName = Section name of the type [xxxx] KeyName = Key name separated by an equal to sign, of the type abc = 123 filename |
|---|
| 43 | = ini file name to be used |
|---|
| 44 | </p> |
|---|
| 45 | <p>ret = string (!) value of the key found, empty ('') if key was not found. Since it's a string, you have to convert to |
|---|
| 46 | integers / floats on your own. |
|---|
| 47 | </p> |
|---|
| 48 | <p>Note that AppName and KeyName are NOT case sensitive, and that whitespace between '=' and the value will be ignored (removed).</p> |
|---|
| 49 | <p>If the key or the AppName is not found, or if the inifile does not exist or could not be opened, '' will be returned (this |
|---|
| 50 | will also be returned when the key is empty). |
|---|
| 51 | </p> |
|---|
| 52 | <h2>Examples:<a name="11"></a></h2><pre class="codeinput"> <span class="comment">%a sample ini file (sample.ini) may have entries:</span> |
|---|
| 53 | <span class="comment">%</span> |
|---|
| 54 | <span class="comment">% [XYZ]</span> |
|---|
| 55 | <span class="comment">% abc=123</span> |
|---|
| 56 | <span class="comment">% def=7</span> |
|---|
| 57 | <span class="comment">% ; lines starting with a ; are comments</span> |
|---|
| 58 | <span class="comment">% [ZZZ]</span> |
|---|
| 59 | <span class="comment">% abc=890</span> |
|---|
| 60 | </pre><pre class="codeinput"> readFromIniFile(<span class="string">'XYZ'</span>,<span class="string">'abc'</span>, <span class="string">'sample.ini'</span>) <span class="comment">% will return '123'</span> |
|---|
| 61 | </pre><pre class="codeinput"> readFromIniFile(<span class="string">'ZZZ'</span>,<span class="string">'abc'</span>, <span class="string">'sample.ini'</span>) <span class="comment">% will return '890'</span> |
|---|
| 62 | </pre><pre class="codeinput"> readFromIniFile(<span class="string">'XYZ'</span>,<span class="string">'def'</span>, <span class="string">'sample.ini'</span>) <span class="comment">% will return '7'</span> |
|---|
| 63 | </pre><h2>See also<a name="17"></a></h2> |
|---|
| 64 | |
|---|
| 65 | <div> |
|---|
| 66 | <ul> |
|---|
| 67 | <li><b>Author:</b> Linus Atorf (see AUTHORS) |
|---|
| 68 | </li> |
|---|
| 69 | <li><b>Date:</b> 2008/01/08 |
|---|
| 70 | </li> |
|---|
| 71 | <li><b>Copyright:</b> 2007-2008, RWTH Aachen University |
|---|
| 72 | </li> |
|---|
| 73 | </ul> |
|---|
| 74 | </div> |
|---|
| 75 | <p class="footer"><br> |
|---|
| 76 | Published with wg_publish; V1.0<br></p> |
|---|
| 77 | </div> |
|---|
| 78 | <!-- |
|---|
| 79 | ##### SOURCE BEGIN ##### |
|---|
| 80 | %% readFromIniFile |
|---|
| 81 | % Reads parameters from a configuration file (usually *.ini) |
|---|
| 82 | %% |
|---|
| 83 | %% Syntax |
|---|
| 84 | % |ret = readFromIniFile(AppName, KeyName, filename)| |
|---|
| 85 | %% |
|---|
| 86 | %% Description |
|---|
| 87 | % ret=readFromIniFile(AppName, KeyName, filename) |
|---|
| 88 | %% |
|---|
| 89 | % This function works like GetPrivateProfileString() from the Windows-API |
|---|
| 90 | % that is well known for reading ini-file data. The parameters are: |
|---|
| 91 | %% |
|---|
| 92 | % AppName = Section name of the type [xxxx] |
|---|
| 93 | % KeyName = Key name separated by an equal to sign, of the type abc = 123 |
|---|
| 94 | % filename = ini file name to be used |
|---|
| 95 | %% |
|---|
| 96 | % ret = string (!) value of the key found, empty ('') if key was not |
|---|
| 97 | % found. Since it's a string, you have to convert to |
|---|
| 98 | % integers / floats on your own. |
|---|
| 99 | %% |
|---|
| 100 | % Note that AppName and KeyName are NOT case sensitive, and that whitespace |
|---|
| 101 | % between '=' and the value will be ignored (removed). |
|---|
| 102 | %% |
|---|
| 103 | % If the key or the AppName is not found, or if the inifile does not |
|---|
| 104 | % exist or could not be opened, '' will be returned (this will also be |
|---|
| 105 | % returned when the key is empty). |
|---|
| 106 | %% |
|---|
| 107 | %% Examples: |
|---|
| 108 | %a sample ini file (sample.ini) may have entries: |
|---|
| 109 | % |
|---|
| 110 | % [XYZ] |
|---|
| 111 | % abc=123 |
|---|
| 112 | % def=7 |
|---|
| 113 | % ; lines starting with a ; are comments |
|---|
| 114 | % [ZZZ] |
|---|
| 115 | % abc=890 |
|---|
| 116 | %% |
|---|
| 117 | readFromIniFile('XYZ','abc', 'sample.ini') % will return '123' |
|---|
| 118 | %% |
|---|
| 119 | readFromIniFile('ZZZ','abc', 'sample.ini') % will return '890' |
|---|
| 120 | %% |
|---|
| 121 | readFromIniFile('XYZ','def', 'sample.ini') % will return '7' |
|---|
| 122 | %% |
|---|
| 123 | %% |
|---|
| 124 | %% See also |
|---|
| 125 | % |
|---|
| 126 | %% |
|---|
| 127 | %% |
|---|
| 128 | %% Signature |
|---|
| 129 | %% |
|---|
| 130 | % * *Author:* Linus Atorf (see AUTHORS) |
|---|
| 131 | % * *Date:* 2008/01/08 |
|---|
| 132 | % * *Copyright:* 2007-2008, RWTH Aachen University |
|---|
| 133 | % |
|---|
| 134 | |
|---|
| 135 | ##### SOURCE END ##### |
|---|
| 136 | --> |
|---|
| 137 | </body> |
|---|
| 138 | </html> |
|---|