Lines Matching refs:file

4  * you may not use this file except in compliance with the License.
112 ifstream file(filePath.c_str());
113 if (!file.is_open()) {
114 UTILS_LOGD("open file failed! filePath:%{public}s", filePath.c_str());
118 file.seekg(0, ios::end);
119 const long long fileLength = file.tellg();
121 UTILS_LOGD("invalid file length(%{public}lld)!", fileLength);
126 file.seekg(0, ios::beg);
127 copy(istreambuf_iterator<char>(file), istreambuf_iterator<char>(), back_inserter(content));
153 UTILS_LOGD("LoadStringFromFd get file name by fd failed!");
158 UTILS_LOGE("LoadStringFromFd get string from file failed!");
173 UTILS_LOGE("invalid file length(%{public}jd)!", static_cast<intmax_t>(fileLength));
177 // lseek is not support the linux file node
189 UTILS_LOGE("lseek file to begin failed!");
195 UTILS_LOGE("the length read from file is not equal to fileLength!len:%{public}zd,fileLen:%{public}jd",
210 ofstream file;
212 file.open(filePath.c_str(), ios::out | ios::trunc);
214 file.open(filePath.c_str(), ios::out | ios::app);
217 if (!file.is_open()) {
218 UTILS_LOGD("open file failed! filePath:%{private}s", filePath.c_str());
222 file.write(content.c_str(), content.length());
223 if (file.fail()) {
224 UTILS_LOGE("write content to file failed!file:%{private}s, content:%{private}s",
245 UTILS_LOGE("write file failed!errno:%{public}d, err:%{public}s", errno, strerror(errno));
250 UTILS_LOGE("the length write to file is not equal to fileLength!len:%{public}zd, fileLen:%{public}zu",
268 UTILS_LOGD("open file failed! filePath:%{private}s", realPath.c_str());
276 UTILS_LOGE("LoadBufferFromNodeFile invalid file length(%{public}d)!", byteCount);
293 /* load file to buffer. If the buffer is not empty,then overwrite */
296 ifstream file;
297 file.open(filePath.c_str(), ios::in | ios::binary);
298 if (!file.is_open()) {
299 UTILS_LOGD("open file failed! filePath:%{private}s", filePath.c_str());
303 file.seekg(0, std::ios::end);
304 const long long fileLength = file.tellg();
306 UTILS_LOGD("invalid file length(%{public}lld)!", fileLength);
310 // lseek is not support the linux file node
320 file.seekg(0, std::ios::beg);
321 if (file.fail()) {
322 UTILS_LOGE("seekg file to begin failed!filePath:%{private}s", filePath.c_str());
327 file.read(&content[0], fileLength);
338 // if the file is not exist,create it first!
340 ofstream file;
341 file.open(filePath.c_str(), mode);
342 if (!file.is_open()) {
343 UTILS_LOGD("open file failed! filePath:%{private}s, mode:%{private}d", filePath.c_str(), mode);
347 file.write(&content[0], content.size());
348 file.flush();