Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
src_corelib_io_qtemporaryfile.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3
4{
6 // Within a function/method...
7
8 QTemporaryFile file;
9 if (file.open()) {
10 // file.fileName() returns the unique file name
11 }
12
13 // The QTemporaryFile destructor removes the temporary file
14 // as it goes out of scope.
16}
17
19 QFile f(":/resources/file.txt");
20 QTemporaryFile::createNativeFile(f); // Returns a pointer to a temporary file
21
22 QFile f("/users/qt/file.txt");
23 QTemporaryFile::createNativeFile(f); // Returns 0
\inmodule QtCore
Definition qfile.h:93
QFILE_MAYBE_NODISCARD bool open(OpenMode flags) override
Opens the file using OpenMode mode, returning true if successful; otherwise false.
Definition qfile.cpp:904
GLfloat GLfloat f
QFile file
[0]
QFile f(":/resources/file.txt")
[0]