小编use*_*081的帖子

Git添加不添加文件

当我尝试git添加我的文件时,我输入了

git add <insert file names here>
Run Code Online (Sandbox Code Playgroud)

这工作正常.但是,当我尝试做的时候

git commit -a
Run Code Online (Sandbox Code Playgroud)

我的git存储库告诉我它是空的.输出的是:

# On branch master
# Untracked files:
#   (use "git add <file>..." to include in what will be committed) 
#
<insert name of files here>

nothing added to commit but untracked files present (use "git add" to track)
Run Code Online (Sandbox Code Playgroud)

可能有人知道解决方案吗?谢谢.

git git-add git-commit

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

从8位转换为1位

我有一个8位的字符串,我想将其转换为1个字节.我不确定为什么我的功能不能正常工作.我将8位存储到8个无符号字符的数组中.到目前为止这是我的方法:

unsigned int bitsToBytes(unsigned char *bits)
{
  unsigned int sum = 0;
  for(int i = 7; i >= 0; i--)
  {
    sum += bits[i];
    sum<<=1;
  }
  return sum;

}

int main()
{
  unsigned char bits[8];
  unsigned int byt;
  byt = bitsToBytes(bits);
  cout << byt; //doesn't give me the right result
}
Run Code Online (Sandbox Code Playgroud)

编辑:我的数组在数组中包含'1'和'0'!对不起,不清楚.

可能有人知道我在哪里出错了吗?我不确定为什么我的位没有正确转换为字节.有人可以帮忙吗?谢谢!

c++ byte bit-shift

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

标签 统计

bit-shift ×1

byte ×1

c++ ×1

git ×1

git-add ×1

git-commit ×1