mirror of
https://github.com/crystalidea/qt6windows7.git
synced 2025-07-07 17:50:59 +08:00
qt 6.5.1 original
This commit is contained in:
@ -0,0 +1,12 @@
|
||||
# Copyright (C) 2022 The Qt Company Ltd.
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
#####################################################################
|
||||
## fileWriterProcess Binary:
|
||||
#####################################################################
|
||||
|
||||
qt_internal_add_executable(fileWriterProcess
|
||||
OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/"
|
||||
SOURCES
|
||||
main.cpp
|
||||
)
|
28
tests/auto/corelib/io/qprocess/fileWriterProcess/main.cpp
Normal file
28
tests/auto/corelib/io/qprocess/fileWriterProcess/main.cpp
Normal file
@ -0,0 +1,28 @@
|
||||
// Copyright (C) 2016 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
#include <QCoreApplication>
|
||||
#include <QFile>
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
QCoreApplication ca(argc, argv);
|
||||
QFile f;
|
||||
f.open(stdin, QIODevice::ReadOnly);
|
||||
QByteArray input;
|
||||
char buf[1024];
|
||||
qint64 len;
|
||||
while ((len = f.read(buf, 1024)) > 0)
|
||||
input.append(buf, len);
|
||||
f.close();
|
||||
QFile f2("fileWriterProcess.txt");
|
||||
if (!f2.open(QIODevice::WriteOnly | QIODevice::Truncate)) {
|
||||
fprintf(stderr, "Cannot open %s for writing: %s\n",
|
||||
qPrintable(f2.fileName()), qPrintable(f2.errorString()));
|
||||
return 1;
|
||||
}
|
||||
f2.write(input);
|
||||
f2.close();
|
||||
return 0;
|
||||
}
|
Reference in New Issue
Block a user