printf输出重定向到文件中
来源:互联网 发布:windows 文件夹同步 编辑:程序博客网 时间:2024/04/23 16:46
win_main.cpp
#include "precompileHeader.h "int APIENTRY _tWinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPTSTR lpCmdLine,int nCmdShow){char strTempPath[MAX_PATH];GetSpecialPath(_T("sysinfo_detect.log"),strTempPath);freopen(strTempPath,"a+",stdout);printf(" what the fucker man!!!!\n");printf(" what the fucker man!!!!\n");printf(" what the fucker man!!!!\n");printf(" what the fucker man!!!!\n");return 1;}
precompileHeader.h
#pragma once// 如果必须要针对低于以下指定版本的平台,请修改下列定义。// 有关不同平台对应值的最新信息,请参考 MSDN。#ifndef _WIN32_WINNT // 指定要求的最低平台是 Windows xp。#define _WIN32_WINNT 0x0501 // 将此值更改为相应的值,以适用于 Windows 的其他版本。#endif#include <Windows.h>#include <stdio.h>#include <tchar.h>#include <stdlib.h>#include <stdint.h>#include <string.h>void GetSpecialPath(char *filename,char *strTempPath,int length =MAX_PATH) {// char strTempPath[MAX_PATH];memset(strTempPath,0,MAX_PATH);GetModuleFileName(NULL,strTempPath,length);//strrchr(strTempPath,'\\')[1]=0; // 将\字符置0strrchr(strTempPath,'\\')[1]=0; // 将\后第一个字符置0,看使用情况酌情处理strcat(strTempPath,filename);}
阅读全文
0 0
- printf输出重定向到文件中
- printf重定向输出到文件
- vc6 printf重定向输出到文件
- 串口输出重定向到 printf
- 嵌入式调试printf重定向到文件
- STM32中printf重定向到串口
- STM32中printf重定向到串口
- STM32中printf重定向到串口
- linux 实现输出重定向(printf 打印,输出到指定文件(不输出到终端))
- C++中关于输出流重定向到文件
- 在窗口应用中使用printf,cout 等将输出重定向到console
- 在窗口应用中使用printf,cout 等将输出重定向到console
- 在窗口应用中使用printf,cout 等将输出重定向到console
- Keil重定向printf到串口UART输出
- STM32输出调试信息-printf重定向到串口
- 重定向输出以追加到文件
- 将make 输出重定向到文件
- 重定向子进程输出到文件
- 借助UltraISO制作U盘启动盘
- 初识Log4j
- C++细节(1):关于形参中&符号的意义
- SpringMVC中的注解@RequestParam解析
- c++知识点---举例说明 转换构造函数 和 类型转换函数
- printf输出重定向到文件中
- [二维树状数组]BZOJ 1452—— [JSOI2009]Count
- codeforces contest 868 problem C(补集 状压)
- [2017.10.1]条件控制&循环控制
- 软件工程项目设计
- 在Revit中自由快速的给复杂结构加钢筋的办法
- 实战java高并发之java并发包
- JAVA提高篇(11)-- DataInputStream和DataoutputStream
- 【51nod】1083 矩阵取数问题