MCPcopy Create free account
hub / github.com/DCMTK/dcmtk / DcmFileStream

Method DcmFileStream

dcmdata/libsrc/dcstream.cc:89–133  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

87
88
89DcmFileStream::DcmFileStream(const char * filename,
90 const BOOL readMode,
91 const BOOL randomAccess)
92 : DcmStream(readMode, randomAccess)
93
94{
95 fErrorCond = EC_Normal;
96 fFilename = NULL;
97
98 if (filename)
99 {
100 fFilename = new char[strlen(filename)+1];
101 if (fFilename)
102 strcpy(fFilename, filename);
103
104 if (fReadMode)
105 fFile = fopen(filename, "rb"); // open read only
106 else
107 fFile = fopen(filename, "wb"); // open write only
108
109 if (!fFile)
110 fErrorCond = EC_InvalidStream;
111
112
113 }
114 else
115 fErrorCond = EC_InvalidStream;
116
117 if (fErrorCond != EC_Normal)
118 {
119 if (fFile)
120 fclose(fFile);
121 fFile = NULL;
122 }
123 else
124 {
125 // Get number of bytes in file
126 fseek(fFile, 0L, SEEK_END);
127 fNumBytes = (Uint32)ftell(fFile);
128 fseek(fFile, 0L, SEEK_SET);
129 }
130
131 fPutbackMode = FALSE;
132 fNumPutbackBytes = 0;
133}
134
135
136DcmFileStream::~DcmFileStream(void)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected