zoukankan      html  css  js  c++  java
  • API删除文件

    using System;
    using System.Runtime.InteropServices;
    namespace ConsoleApplication1
    {
        class Program
        {
            [DllImport("kernel32.dll")]
            public static extern uint DeleteFile(string fileName);
            [DllImport("kernel32.dll")]
            public static extern uint GetLastError();
            [DllImport("kernel32.dll")]
            public static extern uint FormatMessage(uint dwFlag, ref IntPtr source, uint messageId, uint languageId, ref string lpBuffer, uint size, ref IntPtr va_list);
            static void Main(string[] args)
            {
                string str = null;
                IntPtr tempptr = IntPtr.Zero;
                if (DeleteFile("C:	est.txt") != 0)
                    Console.Write("删除成功!");
                else{
                    FormatMessage(0x1300, ref tempptr, GetLastError(), 0, ref str, 0, ref tempptr);
                    Console.Write("删除失败!
    失败原因:" + str);
                }
            }
        }
    }
  • 相关阅读:
    SNOI2017炸弹
    tarjan进阶
    BZOJ3331压力
    将多个对象合并为一个对象
    原型模式详解
    HTML5
    isAnimated函数
    让函数执行的各种方式
    zepto源码注解
    mobileTech
  • 原文地址:https://www.cnblogs.com/cause/p/3873222.html
Copyright © 2011-2022 走看看