小编Kir*_*ran的帖子

chm viewer无法显示内容

我有一个chm文件,我可以在家里打开.我在家里和工作中使用Windows XP.但是,当我在工作中打开文件时,它不会显示文件的内容.它正确显示了文件的TOC.有什么想法吗?

chm

62
推荐指数
4
解决办法
5万
查看次数

ksh关联数组

我有一个需要使用关联数组的脚本.作为ksh的新手,我无法找到ksh支持关联数组的任何地方.当我尝试使用常规数组语法和赋值时,我得到一个错误,索引不能那么大.ksh是否支持关联数组?如果没有,替代解决方案是什么?

需要执行以下操作:$ {array [$ name]} = value,稍后在代码中,我需要读取$ {array [$ name]}的值.每次脚本运行时,我都要存储大约2000个值并从数组中读取.

不幸的是,我不能使用perl,因为遗留模块的范围要包含在脚本中.感谢任何帮助,提示或技巧.

ksh associative-array

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

c ++转换运算符没有候选者更好

    #include <iostream>
#include <string>

using namespace std;

class test {
    private:
        std::string strValue;
        int value;

    public:
        test():value(0) { };
        test(int a):value(a) { };
        test(std::string a):strValue(a) { };
        ~test(){};

        operator int () { return value; }
        operator const char* () { return strValue.c_str(); }
};

int main() {
    test v1(100);
    cout << v1  << endl;
    return 0;
}
Run Code Online (Sandbox Code Playgroud)

当我运行上面的内容时,使用gcc我得到一个错误,说没有候选人更适合转换..这不是他们的独家类型吗?

c++ operator-overloading operators

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

ksh以特定语句回显stderr

我有以下shell脚本,回声输出到日志和错误到err_file.但是,我特别希望向stderr回应一些陈述.请帮忙

#!/bin/ksh
echo "paramPassed: $0 $#" 

err_file="error_file.txt"
new_file="new_file.txt"

exec >> ${new_file}
#exec >> ${new_file} 2>${err_file}
#exec >> ${new_file} 2>&1

if [ $# -eq 1 ]; then
    username=$1
fi  

userInfo=$(paramInfo ${username} | awk -F: '{print $2}')
echo ${userInfo} 

rcp ${err_file} mtvst32:/rcs/ver34/${err_file}

if [ $? -ne 0 ]; then
        #This doesn't work. Need the following to go to console
        echo "UserInfo.SH FAILED copy to mtvst32" >> &2; 
fi  
Run Code Online (Sandbox Code Playgroud)

我希望将最后一个if条件的输出发送到std err但是,无法弄清楚该怎么做.

ksh echo stderr

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