Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
99cf8fa379a0dec73c6efa37cbce2ae95887963f
[xestiacalendar/.git] / source / tests / xestiacalendar_testcommon.cpp
1 #include <fstream>
3 #include "xestiacalendar_testcommon.h"
4 #include "../common/file.h"
6 ProcessConnectionDataFileResult ProcessConnectionDataFile(string DataFilename, 
7         CalDAVConnectionData *ConnData){
8                 
9         ProcessConnectionDataFileResult ProcessResult = PROCESSCONNECTIONDATAFILE_UNITTESTFAIL;
10                 
11         // Check if the file exists and return 
12         // PROCESSCONNECTIONDATAFILE_MISSING if not.
13         
14         if (!FileExists(DataFilename)){
15                 return PROCESSCONNECTIONDATAFILE_MISSING;
16         }
17         
18         ifstream FileStream;
19         string ReceivedStringData = "";
20         
21         FileStream.open(DataFilename, ifstream::in);
22         
23         if (FileStream.rdstate() & ifstream::failbit){
24                 return PROCESSCONNECTIONDATAFILE_CANNOTOPEN;
25         }
27         if (FileStream.rdstate() & ifstream::badbit){
28                 return PROCESSCONNECTIONDATAFILE_CANNOTOPEN;
29         }
30         
31         // Process the file.
32         
33         char *BufferRead = new char[256];
34         
35         while (!FileStream.eof()){
36                 
37                 FileStream.getline(BufferRead, 256);
38                 ReceivedStringData.append(BufferRead);
39                 ReceivedStringData.append("\n");
40                 
41         }
42         
43         delete[] BufferRead;
44         
45         return ProcessResult;
46                 
47 }
Xestia Software Development
Yn Maystri
© 2006 - 2019 Xestia Software Development
Software

Xestia Address Book
Xestia Calendar
Development

Xestia Gelforn
Everything else

About
News
Privacy Policy