小编use*_*858的帖子

Mac终端自动完成

我一直在为这个补丁找一段时间.通常在Unix/Linux终端上按Tab键时它将自动完成,直到有多个选项,然后它将列出以下选项供您选择.例如:

cd he
helpFolder/ helpMe/ heIsThere/
cd help
Run Code Online (Sandbox Code Playgroud)

现在使用Mac终端,它会强制你按两次以查看选项,我想知道是否可以将该设置更改为按一个选项卡?

macos terminal

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

快速将Excel导入DataTable

我试图将Excel文件读入Data.DataTable列表,虽然使用我当前的方法可能需要很长时间.我特意按工作表逐个单元地去工作表,它往往需要很长时间.有更快的方法吗?这是我的代码:

    List<DataTable> List = new List<DataTable>();

    // Counting sheets
    for (int count = 1; count < WB.Worksheets.Count; ++count)
    {
        // Create a new DataTable for every Worksheet
        DATA.DataTable DT = new DataTable();

        WS = (EXCEL.Worksheet)WB.Worksheets.get_Item(count);

        textBox1.Text = count.ToString();

        // Get range of the worksheet
        Range = WS.UsedRange;


        // Create new Column in DataTable
        for (cCnt = 1; cCnt <= Range.Columns.Count; cCnt++)
        {
            textBox3.Text = cCnt.ToString();


                Column = new DataColumn();
                Column.DataType = System.Type.GetType("System.String");
                Column.ColumnName = cCnt.ToString();
                DT.Columns.Add(Column);

            // Create row for …
Run Code Online (Sandbox Code Playgroud)

.net c# excel office-interop

27
推荐指数
2
解决办法
13万
查看次数

在C++'python33_d.lib'中使用Python 3.3未找到

我正在尝试使用#include <Python.h>我的C++代码,当我编译代码时,我得到以下错误:

fatal error LNK1104: cannot open file 'python33_d.lib'
Run Code Online (Sandbox Code Playgroud)

现在我试图python33_d.lib在我的计算机上找到包含在我的链接器依赖项中的文件,但是我找不到.我找到了python33.lib.

我在哪里可以找到python33_d.lib,或者我该如何解决这个问题?

c++ python visual-c++

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

如何使用std :: getline()将文本文件读入C++中的字符串数组?

我试图std::getline()在我的项目中使用将文本文件读入字符串数组.

这是我的代码:

ifstream ifs ( path );
string * in_file;
int count = 0;
while ( !ifs.eof() )
{
    ++count;
    if ( count == 1 )
    {
        in_file = new string[1];
    }
    else
    {
            // Dynamically allocate another space in the stack
    string *old_in_file = in_file;
    in_file = new string[count];
            // Copy over values
    for ( int i = 0 ; i < ( count - 1 ) ; i++ )
    {
        in_file[i] = old_in_file[i];
    }
    delete[] old_in_file; …
Run Code Online (Sandbox Code Playgroud)

c++ arrays file-io fstream dynamic-arrays

8
推荐指数
2
解决办法
2万
查看次数

在QT中创建我自己的异常并在函数中引发异常

我试图在Qt中创建自己的异常类。这是我第一次这样做,我对如何将免除项放入main调用的函数中感到困惑。

我目前所拥有的:

myExcption.h

#ifndef MYEXCEPTION_H
#define MYEXCEPTION_H

#include <qtconcurrentexception.h>
#include <QDebug>

class MyException: public QtConcurrent::Exception
{
public:
    void raise() const {qDebug() << "\nException: "; throw *this;}
};

#endif // MYEXCEPTION_H
Run Code Online (Sandbox Code Playgroud)

现在,我如何抛出豁免是这样的:

myFuction.h

void Commands(QString Command_in, MyException &wrongInput);
Run Code Online (Sandbox Code Playgroud)

myFunction.cpp

void Command(QString Command_in, MyException &wrongInput)
{
    if(Command_in != "some string")
    {
        wrongInput.raise();
    }
}
Run Code Online (Sandbox Code Playgroud)

main.cpp

String s = "some String";
MyException wrongString;
try
{
   Command(s, wrongString);
}
catch(MyException &wrongString)
{
   qDebut << "String invalid";
}
Run Code Online (Sandbox Code Playgroud)

现在可以正常工作了,但是我觉得不必将异常的引用传递给每个函数。我有什么选择?这是我应该可以做的,但是我不确定该怎么做。

myFunction.cpp

void Command(QString Command_in)
{
    if(Command_in …
Run Code Online (Sandbox Code Playgroud)

c++ qt exception-handling

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

如何获得char*x []的大小

我怎么能得到这个的大小:

 char* stringit[4] = {"H","H","UH","i"};
Run Code Online (Sandbox Code Playgroud)

我试过了:

sizeof(stringit);
Run Code Online (Sandbox Code Playgroud)

它输出了32.

我试着做一个for循环:

for (i= 0; check != 0; ++i){
    check = stringit[i];
}
Run Code Online (Sandbox Code Playgroud)

那也不起作用.无论如何要做到这一点,而不必传递数组的大小?

c++

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

在C#中创建数据表

我承认我是C#的新手,但我只是想在我的代码中创建一个新的数据表.我已添加Microsoft.Office.Interop.Excel到我的参考文献中,其中包括:

using Microsoft.Office.Interop.Excel;
Run Code Online (Sandbox Code Playgroud)

这是我的代码看起来像的快照

namespace ExcelReading
{
    class Program
    {   
        static void Main(string[] args)
        {
            DataTable dt = new DataTable();
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

new dataTabel()以红色和错误强调说:

无法创建和抽象类或接口的实例'Microsoft.Office.Interop.Excel.DataTable'

为什么是这样?我该怎么做才能创建这个数据表?

我正在使用VS 2012,.NET Framework 4.5

c# .net-4.5

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

如何在Verilog中快速制作多条线?

我试图非常快地制作总共 24 根电线,但我不断收到错误:

错误 (10170):your_ALU_mux.v(81) 文本“=”附近的 Verilog HDL 语法错误;需要“.”或标识符

这是我的代码:

module your_ALU_mux(your_out, operandA, operandB, opcode, switches, address);
input [7:0] operandA, operandB, address;
input [3:0] opcode, switches;
output [7:0] your_out;

wire [0:7] Bnot, newb, newa;
wire Cin, Cout;

    not
       (Bnot[0], operandB[0]),
       (Bnot[1], operandB[1]),
       (Bnot[2], operandB[2]),
       (Bnot[3], operandB[3]),
       (Bnot[4], operandB[4]),
       (Bnot[5], operandB[5]),
       (Bnot[6], operandB[6]),
       (Bnot[7], operandB[7]);

// Getting A' and B'
    if (address == 16'h00 || address == 16'h01)
    // Add A + B
    if (address == 16'h00)

        // newa = A …
Run Code Online (Sandbox Code Playgroud)

verilog

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

Const Char*name vs Const Char*name

两者之间有区别吗?

const char* name = "name";
Run Code Online (Sandbox Code Playgroud)

const char *name = "name";
Run Code Online (Sandbox Code Playgroud)

谢谢.

c

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

char string*vs char string []

是否有区别:

char string = "name";
const char* point = string;
Run Code Online (Sandbox Code Playgroud)

VS

const char string[] = "name";
Run Code Online (Sandbox Code Playgroud)

你能解释一下这个区别吗?

c

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

将std :: vector传递给函数

我想在我的c ++代码中向向量添加一些值,但每次我尝试将向量发送到main.cpp文件中的函数时,它都用红色加下来并说:

 A nonstatic member reference mus be relative to a specific object.
Run Code Online (Sandbox Code Playgroud)

在我的标题中:

#ifndef HEADER_H
#define HEADER_H
#include <vector>

namespace Functions{
    class MyClass
    {
    public:
        void fun(std::vector<char*> vect);

    };

}
#endif
Run Code Online (Sandbox Code Playgroud)

.cpp文件:

void Functions::MyClass::fun(std::vector<char*> vect){
    vect.push_back("value 1");
    vect.push_back("Save File Name");
}
Run Code Online (Sandbox Code Playgroud)

Main.cpp的

#include "Header.h"    
#include <vector>
int main(){ 
  std::vector<char*>vect;
  Functions::MyClass::fun(vect);
  return 0;
}
Run Code Online (Sandbox Code Playgroud)

c++

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