tool/CommandRegWrite.cpp
branchstable-1.5
changeset 2421 bc2d4bf9cbe5
parent 1968 4f682084c643
child 2443 2c3ccdde3919
equal deleted inserted replaced
2420:69056c46aa4d 2421:bc2d4bf9cbe5
    49 {
    49 {
    50     stringstream str;
    50     stringstream str;
    51 
    51 
    52     str << binaryBaseName << " " << getName()
    52     str << binaryBaseName << " " << getName()
    53         << " [OPTIONS] <OFFSET> <DATA>" << endl
    53         << " [OPTIONS] <OFFSET> <DATA>" << endl
    54         << endl 
    54         << endl
    55         << getBriefDescription() << endl
    55         << getBriefDescription() << endl
    56         << endl
    56         << endl
    57         << "This command requires a single slave to be selected." << endl
    57         << "This command requires a single slave to be selected." << endl
    58         << endl
    58         << endl
    59         << "Arguments:" << endl
    59         << "Arguments:" << endl
    89 
    89 
    90     if (args.size() != 2) {
    90     if (args.size() != 2) {
    91         err << "'" << getName() << "' takes exactly two arguments!";
    91         err << "'" << getName() << "' takes exactly two arguments!";
    92         throwInvalidUsageException(err);
    92         throwInvalidUsageException(err);
    93     }
    93     }
    94     
    94 
    95     strOffset << args[0];
    95     strOffset << args[0];
    96     strOffset
    96     strOffset
    97         >> resetiosflags(ios::basefield) // guess base from prefix
    97         >> resetiosflags(ios::basefield) // guess base from prefix
    98         >> data.offset;
    98         >> data.offset;
    99     if (strOffset.fail()) {
    99     if (strOffset.fail()) {
   100         err << "Invalid offset '" << args[0] << "'!";
   100         err << "Invalid offset '" << args[0] << "'!";
   101         throwInvalidUsageException(err);
   101         throwInvalidUsageException(err);
   102     }
   102     }
   103   
   103 
   104     if (getDataType().empty()) {
   104     if (getDataType().empty()) {
   105         if (args[1] == "-") {
   105         if (args[1] == "-") {
   106             loadRegData(&data, cin);
   106             loadRegData(&data, cin);
   107         } else {
   107         } else {
   108             file.open(args[1].c_str(), ifstream::in | ifstream::binary);
   108             file.open(args[1].c_str(), ifstream::in | ifstream::binary);