3 #include "xestiacalendar_testcommon.h"
4 #include "../common/file.h"
6 ProcessConnectionDataFileResult ProcessConnectionDataFile(string DataFilename,
7 CalDAVConnectionData *ConnData){
9 ProcessConnectionDataFileResult ProcessResult = PROCESSCONNECTIONDATAFILE_UNITTESTFAIL;
11 // Check if the file exists and return
12 // PROCESSCONNECTIONDATAFILE_MISSING if not.
14 if (!FileExists(DataFilename)){
15 return PROCESSCONNECTIONDATAFILE_MISSING;
19 string ReceivedStringData = "";
21 FileStream.open(DataFilename, ifstream::in);
23 if (FileStream.rdstate() & ifstream::failbit){
24 return PROCESSCONNECTIONDATAFILE_CANNOTOPEN;
27 if (FileStream.rdstate() & ifstream::badbit){
28 return PROCESSCONNECTIONDATAFILE_CANNOTOPEN;
33 char *BufferRead = new char[256];
35 while (!FileStream.eof()){
37 FileStream.getline(BufferRead, 256);
38 ReceivedStringData.append(BufferRead);
39 ReceivedStringData.append("\n");