146 | | |
147 | | {{{ |
148 | | bool ReadLine(std::string& str); |
149 | | }}} |
| 146 | Reads a text file a line at a time. |
| 147 | {{{ |
| 148 | bool ReadLine(std::string& strLine); |
| 149 | }}} |
| 150 | |
| 151 | ==== Parameters ==== |
| 152 | |
| 153 | * strLine - string reference to return line read |
| 154 | |
| 155 | ==== Return Value ==== |
| 156 | |
| 157 | Returns true if line read, false if end of file |
| 158 | |
| 159 | ==== Remarks ==== |
| 160 | |
| 161 | ==== Example ==== |
| 162 | |
| 163 | {{{ |
| 164 | CFile file("/mnt/nand/apps/test/config.txt", "r"); |
| 165 | if(file.IsOpen()) |
| 166 | { |
| 167 | string strLine; |
| 168 | while(file.ReadLine(strLine) == true) |
| 169 | { |
| 170 | if(strLine.substr(0, 7) == "Setting") |
| 171 | { |
| 172 | // TODO Parse the settings line |
| 173 | } |
| 174 | } |
| 175 | file.Close(); |
| 176 | } |