| 1726 | } |
| 1727 | |
| 1728 | void OpenOutputFile(fixed_basic_ofstream<TCHAR>& out, const TSTRING& strFile) // throw( eTextReportViewer ) |
| 1729 | { |
| 1730 | std::string narrowFilename = cStringUtil::TstrToStr(strFile); |
| 1731 | |
| 1732 | // we explicitly create the file so that we control the |
| 1733 | // permissions on the new file. |
| 1734 | unlink(narrowFilename.c_str()); |
| 1735 | int fd = open(narrowFilename.c_str(), O_RDWR | O_CREAT | O_TRUNC | O_EXCL, 00600); |
| 1736 | if (fd == -1 || close(fd) != 0) |
| 1737 | { |
| 1738 | throw eTextReportViewerFileOpen(strFile); |
| 1739 | } |
| 1740 | |
| 1741 | out.open(narrowFilename.c_str()); |
| 1742 | |
| 1743 | if (!out.is_open()) |
| 1744 | throw eTextReportViewerFileOpen(strFile); |
| 1745 | } |
| 1746 | |
| 1747 | bool SpecEmpty(const cFCOReportSpecIter& ri) |
| 1748 | { |