小编hox*_*nox的帖子

如何在bash上使用filetype将文件排序到文件夹中(使用'file'命令)?

恢复后我有成千上万的文件没有扩展(主要是图片).我需要按文件类型将它们分类到单独的文件夹中(必须在排序过程中创建文件夹).我可以使用"file"命令在linux中确定filetype.有人有bash脚本吗?

例如:初始目录包含文件:001,002,003,004.排序后应为3个目录:'jpeg'包含001.jpg,003.jpg; 'tiff'包含002.tiff,'others'包含004.

linux bash file-type file

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

我可以写类似于@code或@verbatim的doxygen别名吗?

我需要一个别名来标记命令行代码,设置在带有白色文本的黑色背景上,如下所示:

@cmd
C:\temp>echo Hello, world!
Hello, world!

C:\temp>
@endcmd
Run Code Online (Sandbox Code Playgroud)

普通的doxygen的别名不能做到这一点(多,嵌套"\ TEMP"),但@code@verbatim能.但是,我不能使用它们,因为它们被格式化为带有黑色文本的白色背景,因此用自定义CSS覆盖pre.fragment类是不正确的.

有任何想法吗?

UPD:评论显示我的英语有多糟糕......

好吧,再试一次.常规doxygen的功能如HTML和XML的工作方式如下所示:

    cpp file                       doxygen produced index.html
/**
@mainpage main               |  
<pre>                        | <pre>C:&gt;echo Hello, world! 
C:\temp>echo Hello, world!   | Hello, world!</pre>  
Hello, world!                |
                             |
C:\temp>                     | <pre>C:&gt;</pre>
</pre>                       |
*/                           |
Run Code Online (Sandbox Code Playgroud)

在日志中:

/tmp/index.h:3: warning: Found unknown command `\temp'
/tmp/index.h:6: warning: Found unknown command `\temp'
Run Code Online (Sandbox Code Playgroud)

"代码"和"逐字"的工作方式不同!感到不同:

  cpp file                       doxygen produced index.html
/**
@mainpage main               |
@verbatim                    | <div class="fragment">
C:\temp>echo Hello, world! …
Run Code Online (Sandbox Code Playgroud)

doxygen

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

如何使用Qt平台独立捕获异常?

我在项目中使用boost :: date_time。如果日期无效,它将阻止std :: out_of_range C ++异常。在Windows平台上的Qt的gui应用程序中,它成为SEH例外,因此它不会被try | catch范例和编程模版所困扰。如何独立捕获异常平台?

try{
    std::string ts("9999-99-99 99:99:99.999");
    ptime t(time_from_string(ts))
}
catch(...)
{
    // doesn't work on windows
}
Run Code Online (Sandbox Code Playgroud)

编辑: 如果有人不理解,我写了另一个例子:

Qt专业版文件:

TEMPLATE = app
DESTDIR  = bin
VERSION  = 1.0.0
CONFIG  += debug_and_release build_all
TARGET = QExceptExample
SOURCES += exceptexample.cpp \
           main.cpp
HEADERS += exceptexample.h
Run Code Online (Sandbox Code Playgroud)

除了example.h

#ifndef __EXCEPTEXAMPLE_H__
#define __EXCEPTEXAMPLE_H__

#include <QtGui/QMainWindow>
#include <QtGui/QMessageBox>
#include <QtGui/QPushButton>
#include <stdexcept>

class PushButton;
class QMessageBox;

class ExceptExample : public QMainWindow
{
  Q_OBJECT
  public:
    ExceptExample();
    ~ExceptExample();
  public slots: …
Run Code Online (Sandbox Code Playgroud)

c++ qt cross-platform exception-handling exception

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

将STL字符串数组转换为const char*数组的最有效方法是什么?

我们有:

 std::string string_array[2];

 string_array[0] = "some data";

 string_array[1] = "some more data";

 char* cstring_array[2];
Run Code Online (Sandbox Code Playgroud)

将数据从string_array复制到cstring_array的最有效方法是什么?或者将string_array传递给函数,需要" const char* cstring_array[]"?

c++ arrays cstring stdstring

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