小编Tob*_*ght的帖子

从 `ls` 中删除前 3 列?

如果我这样做ls -o,我得到

-rw-rw-r-- 1 louise     347967 Aug 28  2017 Screenshot from 2017-08-28 09-33-01.png
-rw-rw-r-- 1 louise     377739 Aug 29  2017 Screenshot from 2017-08-29 10-39-49.png
-rw-rw-r-- 1 louise     340682 Aug 29  2017 Screenshot from 2017-08-29 10-40-02.png
Run Code Online (Sandbox Code Playgroud)

我真的想删除前 3 列,所以我得到

347967 Aug 28  2017 Screenshot from 2017-08-28 09-33-01.png
377739 Aug 29  2017 Screenshot from 2017-08-29 10-39-49.png
340682 Aug 29  2017 Screenshot from 2017-08-29 10-40-02.png
Run Code Online (Sandbox Code Playgroud)

ls不能这样做,似乎。这里还有其他关于删除多列的问题,但不是从一开始。

linux bash awk cut

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

将uint64_t Bitmask转换为bool的std :: array

目标是将a std::uint64_t(用作位掩码)转换为a std::array<bool>.

这个问题类似于C#问题如何将int转换为bool数组?,但对于C++而言,我正在寻找具有最佳性能的算法.

给定a std::uint64_t,用作位掩码,我知道可以按位循环遍历其内容,并将bitcompare值设置为位于相同位置的值std::array<bool>.

但是在全能的C++ 必须有一种更有效的方式!也许一些肮脏的演员,mallocs或诸如此类的东西?一切都好; 我在Windows/GCC上,所以即使是仅GCC功能也是完全允许的.

c++ arrays performance gcc stdarray

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

BigQuery标准sql没有删除?

我无法删除 定义的范围where

我的查询:

delete from `dataset.events1` as t where t.group='error';
Run Code Online (Sandbox Code Playgroud)

结果:

错误:UPDATEDELETE表上的语句dataset.events1会影响流缓冲区中的行,这是不支持的。

google-bigquery

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

当使用'extern"C"'时,是什么导致错误"预期字符串文字,但发现用户定义的字符串文字"?

我有包含这些声明的代码:

class IRealNetDll;

extern "C"__declspec(dllexport)
IRealNetDll * CreateRealInstance(int ilicence);
Run Code Online (Sandbox Code Playgroud)

这在Win7上使用Visual Studio 2012正确构建.

但是对于Windows 10上的VS 2015,2017,这一行:

extern "C"__declspec(dllexport)
Run Code Online (Sandbox Code Playgroud)

结果是:

error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
error C3690: expected a string literal, but found a user-defined string literal instead
error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
error C2146: syntax error: missing ';' before identifier 'IRealNetDll'
Run Code Online (Sandbox Code Playgroud)

为什么我会收到此错误,为什么只有较新的编译器,以及如何防止它?

c++ visual-studio visual-c++ visual-studio-2012 windows-10

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

使用循环在C中打印图案

要打印的模式(对于用户输入n)是:

                        4 4 4 4 4 4 4  
                        4 3 3 3 3 3 4   
                        4 3 2 2 2 3 4   
                        4 3 2 1 2 3 4   
                        4 3 2 2 2 3 4   
                        4 3 3 3 3 3 4   
                        4 4 4 4 4 4 4 
Run Code Online (Sandbox Code Playgroud)

我的尝试:

#include <stdio.h>

int main() 
{
    int i,j,k,l,p,n,tc,i1,j1,k1;
    n=4;

    for(i=1;i<=n*2-1;i++)
    {
        p=n;
        if(i<=n)
        {
        for(j=1;j<=i-1;j++)
        {
            printf("%d ",p);
            p--;
        }
        for(k=j;k<=n*2-j;k++)
            printf("%d ",p);
        for(l=k;l<=n*2-1;l++)
        {
            p++;
            printf("%d ",p);
        }
        } …
Run Code Online (Sandbox Code Playgroud)

c

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

为什么此测试总是返回false?

请忽略此代码的上下文。当时的想法是命名的函数shop()将采取两个参数(money_in_pocketage),并确定这些值将让他们成为劳力士专卖店。但是,即使参数满足if语句中的要求 shop(),程序仍将继续输出“ Leave!”-表示离开存储区。

您可能已经注意到,我是该语言的新手,所以对您的帮助将不胜感激。

我试图使参数远远大于if 语句要求的参数。输出为“ leave!”,因此我尝试了不符合要求的参数,并显示了相同的输出...

#include <iostream>

using namespace std;

class rolex{

   public:
      bool shop(int x, int y){
         if((x >= 5000 && y>= 18)||(x>=5000 && y<18)){
            bool enterence = true;
         }else{
            bool enterence = false;
         };
         return enterence;
      }
   private:
      bool enterence;
};

int main()
{
   rolex objj;

   if( objj.shop(5000, 18) == true){
      cout<<"you may enter"<<endl;
   }else{
      cout<<"LEAVE"<<endl;
   }
   return 0;
}
Run Code Online (Sandbox Code Playgroud)

c++ variables scope if-statement

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

是什么导致“不兼容的隐式声明”警告?

我正在尝试使用该strlen()函数找出字符串中的字符数。用户输入一个句子,并且代码必须显示字符串中的字符数。

int l;
char string[64];
printf("Enter a statement: \n");
scanf("%s",&string);
l = strlen(string);
printf("%d",l);
Run Code Online (Sandbox Code Playgroud)

该代码无法正确运行,并显示以下警告:[警告]内置函数'strlen'的不兼容隐式声明

我确实在网上找到了正确的代码,但是我的逻辑到底出了什么问题?需要一点帮助。

c strlen

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

如何使用隐藏的 *this 指针?

我有这个代码:

class Something
{
private:
    int m_value = 0;
public:
    Something add(int value)
    {
        m_value += value;
        return *this;
    }
    int getValue()
    {
        return m_value;
    }

};

int main()
{
    Something a;
    Something b = a.add(5).add(5);
    cout << a.getValue() << endl;
    cout << b.getValue() << endl;
}
Run Code Online (Sandbox Code Playgroud)

输出:

5
10
Run Code Online (Sandbox Code Playgroud)

我想add()返回该a对象,以便第二个add()就像(*this).add(5),但这不起作用。不过,b很好(怎么样?)。我预计a是 10,与 相同b

那么,我在哪里错过了隐藏指针的用法呢?我应该怎么做才能将a.add(5).add(5)变为10?m_valuea

c++ this method-chaining

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

在ZIO中,flatMap和zipRight有什么区别?

看看他们的签名,这些看起来非常相似。ZIO 中这两个函数之间的语义差异是什么\xe2\x80\x99?

\n

scala zio

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

OpenMP是否支持异步操作?

我已经使用Javascript了一段时间,我喜欢它的异步操作,使用回调或承诺和期货.现在我需要使用OpenMP,但未能找到对这些功能的任何支持.

OpenMP是否支持回调和/或期货?

c future openmp promise async-await

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