我想用c ++读取csv文件,所以这是我的代码
int main(){
ifstream classFile("class.csv");
vector<string> classData;
while (getline(classFile, line,',')) // there is input overload classfile
{
classData.push_back(line);
}
}
Run Code Online (Sandbox Code Playgroud)
这是我的问题:我的问题是当它读取每行的最后一列时(因为它没有用逗号分隔),它读取最后一列数据和下一行数据的第一列,例如,如果我的数据是
className,classLocation,c ++教授,图书馆,约翰
然后它读起来像className/classLocation/Professor c ++/Library/John
无论如何,我可以将我的最后一列与下一行中的第一列分开吗?谢谢,抱歉这令人困惑
我有初始化以下向量的问题:
int main()
{
...
int size = classData.size();
vector<vector<string>> arrayClass[size][3]; // <-- problem
for(int i = 0 ; i < classData.size(); i++)
{
for(int j = 0 ; j < 3; j++)
{
arrayClass[i][j] = classData[j+i];
}
}
}
Run Code Online (Sandbox Code Playgroud)
它说size必须是恒定的价值.有什么想法吗?
我正在尝试通过使用cloudformation设置AWS代码管道并使用github作为源。github存储库由一个组织拥有,我对此具有管理员访问权限。
我能够创建webhook并通过代码管道UI成功创建了整个服务。但是,当我尝试通过Cloudformation Document做同样的事情时,它返回错误
Webhook could not be registered with GitHub. Error cause: Not found [StatusCode: 404, Body: {"message":"Not Found","documentation_url":"https://developer.github.com/v3/repos/hooks/#create-a-hook"}]
我两次都使用了相同的凭据(cloudformation中的OAuth令牌和codepipeline UI中的实际登录弹出窗口),但是当我通过Cloudformation进行操作时,它失败了。
我怀疑我的cloudformation文档是问题所在。但是,当我创建自己的存储库时,cloudformation成功创建了webhook并创建了完整的代码管道服务。
以下是我为了解错误原因所做的测试摘要。
repo并admin:repo_hook启用了来自管理员凭据的OAuth令牌。=>给出上面的错误repo并已admin:repo_hook启用=>成功创建了Webhook和服务以下是我创建Webhook的cloudformation文档的一部分。
AppPipelineWebhook:
Type: 'AWS::CodePipeline::Webhook'
Properties:
Authentication: GITHUB_HMAC
AuthenticationConfiguration:
SecretToken: !Ref GitHubSecret
Filters:
- JsonPath: $.ref
MatchEquals: 'refs/heads/{Branch}'
TargetPipeline: !Ref cfSSMAutomationDev
TargetAction: SourceAction
Name: AppPipelineWebhook
TargetPipelineVersion: !GetAtt cfSSMAutomationDev.Version
RegisterWithThirdParty: true
Run Code Online (Sandbox Code Playgroud)
所以我不确定是什么问题。我怀疑OAuth令牌需要更多特权。有人对此有类似的经验吗?任何建议深表感谢