小编use*_*986的帖子

使用Windows ren命令删除!从文件名

我有一堆文件格式如下

filename-!#.ext
Run Code Online (Sandbox Code Playgroud)

其中#是一个递增的数字,以防止碰撞.我想删除!从文件名中读取为

filename-#.ext
Run Code Online (Sandbox Code Playgroud)

似乎我可以使用ren命令和通配符执行此操作,但很难让它工作.我试过这个:

ren *!?.ext *?.ext
Run Code Online (Sandbox Code Playgroud)

我的想法是*应该匹配文件名 - 部分,然后!,然后是?对于数字.但是,生成的文件名为:

filename-!#.ext.ext
Run Code Online (Sandbox Code Playgroud)

我无法弄清楚原因.

文件名部分可以是动态的,但不包含任何!.有任何想法吗?

cmd batch-file

4
推荐指数
2
解决办法
450
查看次数

C# 如何立即关闭应用程序 .NET Framework

如果用户选择的文件夹不包含我正在查找的文件,我将尝试立即关闭我的应用程序。我的代码到达 Application.Exit() 但在运行该行后,应用程序继续运行并到达导致其崩溃的代码。

  public Form1()
    {
        InitializeComponent();

        FolderBrowserDialog dlg = new FolderBrowserDialog();

        if (DialogResult.OK == dlg.ShowDialog())
        {
            particleFolder = dlg.SelectedPath + "\\";
            if(!(File.Exists(particleFolder + "particle.png")))
            {
                Application.Exit();
                return;

            }

        }
....
Run Code Online (Sandbox Code Playgroud)

.net c#

1
推荐指数
1
解决办法
858
查看次数

缺少类型说明符,编译器将Class*更改为int*

我正在制作这个游戏,我正在让每个州都成为一个单身人士.我在使用SandboxState的GetInstance函数时遇到了很多错误.

以下是错误:

错误1错误C2143:语法错误:缺少';' 在'*'c之前:\ users\username\desktop\peggleclone\maze\maze\sandboxstate.cpp 5

错误2错误C2248:'SandboxState :: SandboxState':无法访问在类'SandboxState'中声明的私有成员c:\ users\username\desktop\peggleclone\maze\maze\sandboxstate.cpp 5

错误3错误C2248:'SandboxState :: ~SandboxState':无法访问类'SandboxState'中声明的私有成员c:\ users\username\desktop\peggleclone\maze\maze\sandboxstate.cpp 5

错误4错误C4430:缺少类型说明符 - 假定为int.注意:C++不支持default-int c:\ users\username\desktop\peggleclone\maze\maze\sandboxstate.cpp 6

错误5错误C2556:'int*SandboxState :: GetInstance(void)':重载函数的区别仅在于'SandboxState*SandboxState :: GetInstance(void)'的返回类型c:\ users\username\desktop\peggleclone\maze\maze\sandboxstate.cpp 6

错误6错误C2371:'SandboxState :: GetInstance':重新定义; 不同的基本类型c:\ users\username\desktop\peggleclone\maze\maze\sandboxstate.cpp 6

似乎程序无法识别GetInstance作为SandboxState*的返回值.它一直将它标记为int.我不确定为什么它会尝试在错误2和3中调用构造函数/析构函数.

这是SandboxState.cpp,SandboxState.h和BaseGameState.h

SandboxState.cpp

#include "stdafx.h"
#include "SandboxState.h"


SandboxState* SandboxState::GetInstance(void)
{
    static SandboxState s_Instance;

    return &s_Instance;
}

void SandboxState::Enter()
{


}

void SandboxState::Exit()
{

}

bool SandboxState::Update(float elapsedTime)
{

}

void SandboxState::Render(sf::RenderWindow* window)
{

}
Run Code Online (Sandbox Code Playgroud)

SandboxState.h

#pragma once

#include "BaseGameState.h"
class SandboxState :
public BaseGameState
{ …
Run Code Online (Sandbox Code Playgroud)

c++ class

0
推荐指数
1
解决办法
335
查看次数

标签 统计

.net ×1

batch-file ×1

c# ×1

c++ ×1

class ×1

cmd ×1