Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
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#include <QTemporaryFile>
5
6void examples()
7{
8 //! [0]
9 // Within a function/method...
10
11 QTemporaryFile file;
12 if (file.open()) {
13 // file.fileName() returns the unique file name
14 }
15
16 // The QTemporaryFile destructor removes the temporary file
17 // as it goes out of scope.
18 //! [0]
19
20
21 //! [1]
22 QFile f_pointer(":/resources/file.txt");
23 QTemporaryFile::createNativeFile(f_pointer); // Returns a pointer to a temporary file
24
25 QFile f0("/users/qt/file.txt");
26 QTemporaryFile::createNativeFile(f0); // Returns 0
27 //! [1]
28}
bool examples()
[3]