数据调试

来源:互联网 发布:网络发包工具 编辑:程序博客网 时间:2024/05/29 10:57
#include<iostream>using namespace std;int main(int argc, char** argv){int NumArgs = (argc - 1) / 2;int m;int n;if (argc < 14){for (int i = 0; i < NumArgs; i++){if (strcmp(argv[2 * i + 1], "-N") == 0){n = atoi(argv[2 * i + 2]);}else if (strcmp(argv[2 * i + 1], "-M") == 0){m = atoi(argv[2 * i + 2]);}else{cout << "Error" << endl;}}}cout << m << endl;cout << n << endl; system("pause");}#include<iostream>#include<stdio.h>using namespace std;static struct{    int m;    int n;}profile;static bool read_profile(void){    int ch;    FILE *fin = fopen("profile1.txt", "r");    /*Read Profile*/    while ((ch = getc(fin)) != ':') {}    fscanf(fin, "%d", &profile.m);//1    while ((ch = getc(fin)) != ':') {}    fscanf(fin, "%d", &profile.n);//2    fclose(fin);    return true;}int main(){        read_profile();    cout << profile.m << endl;    cout << profile.n << endl;        system("pause");}



原创粉丝点击