source: cpp/common/virtfile/stdinoutfilesystem.cpp @ 1000

Last change on this file since 1000 was 928, checked in by Maciej Komosinski, 5 years ago

Added virtfile support to recognize the "-" filename as stdin or stdout

File size: 624 bytes
RevLine 
[928]1// This file is a part of Framsticks SDK.  http://www.framsticks.com/
2// Copyright (C) 1999-2020  Maciej Komosinski and Szymon Ulatowski.
3// See LICENSE.txt for details.
4
5#include "stdinoutfilesystem.h"
6#include "stdiofile.h"
7
8VirtFILE *StdInOutFileSystem::Vfopen(const char* path, const char*mode)
9{
10        if (isStdInOutPath(path))
11        {
12                if (*mode == 'r')
13                        return new StdioFILEDontClose(stdin);
14                else
15                        return new StdioFILEDontClose(stdout);
16        }
17        return (chain != NULL) ? chain->Vfopen(path, mode) : NULL;
18}
19
20bool StdInOutFileSystem::isStdInOutPath(const char* path)
21{
22        return strcmp(path, "-") == 0;
23}
Note: See TracBrowser for help on using the repository browser.