Update README.md
[nemesis.git] / Platform / TextReader.cpp
1 /*
2  Copyright (c) 2008 TrueCrypt Developers Association. All rights reserved.
3
4  Governed by the TrueCrypt License 3.0 the full text of which is contained in
5  the file License.txt included in TrueCrypt binary and source code distribution
6  packages.
7 */
8
9 #include "TextReader.h"
10
11 namespace TrueCrypt
12 {
13         TextReader::TextReader (const FilePath &path)
14         {
15                 InputFile.reset (new File);
16                 InputFile->Open (path);
17                 InputStream = shared_ptr <Stream> (new FileStream (InputFile));
18         }
19
20         bool TextReader::ReadLine (string &outputString)
21         {
22                 outputString.erase();
23
24                 char c;
25                 while (InputStream->Read (BufferPtr ((byte *) &c, sizeof (c))) == sizeof (c))
26                 {
27                         if (c == '\r')
28                                 continue;
29
30                         if (c == '\n')
31                                 return true;
32
33                         outputString += c;
34                 }
35                 return !outputString.empty();
36         }
37 }
This page took 0.020244 seconds and 3 git commands to generate. Download a nemesis OSX (sierra+high sierra, tested/working) binary, with fuse-ext3 via e2fsprogs, at this link. application and installer are signed by screwjack, llc. must install fuse with macFUSE layer first.