我已经找到了很多关于如何使用mongodump和mongorestore的良好指示,备份我的流星生产服务器并在需要时恢复备份:
meteor mongo --url myApp.meteor.com
mongodump -u client -h production-db-b2.meteor.io:27017 -d myApp_meteor_com -out dump/2014_10_21 -p [password from meteor mongo --url]
mongorestore -u client -h production-db-b2.meteor.io:27017 -d myApp_meteor_com dump/2014_10_21_v2/myApp_meteor_com -p [password from meteor mongo --url]
Run Code Online (Sandbox Code Playgroud)
我没有找到的解释是如何将备份转储恢复到我的本地流星应用程序.我的app文件夹中有一个mongodump输出.我不确定我是否可以使用mongorestore,或者我是否应该做其他事情.
我只想强制scanf读取单个空格,然后存储字符串的其余部分,直到在变量中找到逗号为止。我不能这样做:
char content[100];
fscanf(f, " %[^,\n],", content);
Run Code Online (Sandbox Code Playgroud)
因为content如果有未决的事情我不想被设置'\n'。有没有办法摆脱空白?
我到目前为止发现的解决方法:
char space;
fscanf(f, "%1[^\n]%[^,\n],", &space, content);
Run Code Online (Sandbox Code Playgroud)
很抱歉这个愚蠢的问题,谢谢您。