C++ (Cpp) strcat Examples

C++ (Cpp) strcat - 30 examples found. These are the top rated real world C++ (Cpp) examples of strcat extracted from open source projects. You can rate examples to help us improve the quality of examples.
Example #1
0
/* univMSSStageToCache - This function is to stage filename (stored in the MSS) to cacheFilename.
 * optionalInfo info is not used.
 */
int univMSSStageToCache (rsComm_t *rsComm, fileDriverType_t cacheFileType,
                         int mode, int flags, char *filename,
                         char *cacheFilename,  rodsLong_t dataSize, keyValPair_t *condInput) {

    int status;
    execCmd_t execCmdInp;
    char cmdArgv[HUGE_NAME_LEN] = "";
    execCmdOut_t *execCmdOut = NULL;

    bzero (&execCmdInp, sizeof (execCmdInp));
    rstrcpy(execCmdInp.cmd, UNIV_MSS_INTERF_SCRIPT, LONG_NAME_LEN);
    strcat(cmdArgv, "stageToCache");
    strcat(cmdArgv, " ");
    strcat(cmdArgv, filename);
    strcat(cmdArgv, " ");
    strcat(cmdArgv, cacheFilename);
    rstrcpy(execCmdInp.cmdArgv, cmdArgv, HUGE_NAME_LEN);
    rstrcpy(execCmdInp.execAddr, "localhost", LONG_NAME_LEN);
    status = _rsExecCmd(rsComm, &execCmdInp, &execCmdOut);

    if (status < 0) {
        status = UNIV_MSS_STAGETOCACHE_ERR - errno;
        rodsLog (LOG_ERROR, "univMSSStageToCache: staging from %s to %s failed, status = %d",
                 filename, cacheFilename, status);
    }

    return (status);

}
Example #2
0
/* univMSSFileRename - This function is to rename a file stored in the MSS.
 */
int univMSSFileRename (rsComm_t *rsComm, char *oldFileName, char *newFileName) {

    int status;
    execCmd_t execCmdInp;
    char cmdArgv[HUGE_NAME_LEN] = "";
    execCmdOut_t *execCmdOut = NULL;

    bzero (&execCmdInp, sizeof (execCmdInp));
    rstrcpy(execCmdInp.cmd, UNIV_MSS_INTERF_SCRIPT, LONG_NAME_LEN);
    strcat(cmdArgv, "mv");
    strcat(cmdArgv, " ");
    strcat(cmdArgv, oldFileName);
    strcat(cmdArgv, " ");
    strcat(cmdArgv, newFileName);
    rstrcpy(execCmdInp.cmdArgv, cmdArgv, HUGE_NAME_LEN);
    rstrcpy(execCmdInp.execAddr, "localhost", LONG_NAME_LEN);
    status = _rsExecCmd(rsComm, &execCmdInp, &execCmdOut);

    if (status < 0) {
        status = UNIV_MSS_RENAME_ERR - errno;
        rodsLog (LOG_ERROR, "univMSSFileRename: rename of %s to error, status = %d",
                 oldFileName, newFileName, status);
    }

    return (status);
}
Example #3
0
static size_t append_number(char* words, int num) {
    int tens_val = num / 10 % 10;
    int ones_val = num % 10;

    size_t len = 0;

    if (tens_val > 0) {
        if (tens_val == 1 && num != 10) {
            strcat(words, TEENS[ones_val]);
            return strlen(TEENS[ones_val]);
        }
        strcat(words, TENS[tens_val]);
        len += strlen(TENS[tens_val]);
        if (ones_val > 0) {
            strcat(words, " ");
            len += 1;
        }
    }

    if (ones_val > 0 || num == 0) {
        strcat(words, ONES[ones_val]);
        len += strlen(ONES[ones_val]);
    }
    return len;
}
Example #4
0
/* univMSSFileChmod - This function is to change ACL for a directory a file in the MSS.
 */
int univMSSFileChmod (rsComm_t *rsComm, char *name, int mode) {

    int status;
    execCmd_t execCmdInp;
    char cmdArgv[HUGE_NAME_LEN] = "";
    char strmode[4];
    execCmdOut_t *execCmdOut = NULL;

    if ( mode != getDefDirMode() ) {
        mode = getDefFileMode();
    }
    bzero (&execCmdInp, sizeof (execCmdInp));
    rstrcpy(execCmdInp.cmd, UNIV_MSS_INTERF_SCRIPT, LONG_NAME_LEN);
    strcat(cmdArgv, "chmod");
    strcat(cmdArgv, " ");
    strcat(cmdArgv, name);
    strcat(cmdArgv, " ");
    sprintf (strmode, "%o", mode);
    strcat(cmdArgv, strmode);
    rstrcpy(execCmdInp.cmdArgv, cmdArgv, HUGE_NAME_LEN);
    rstrcpy(execCmdInp.execAddr, "localhost", LONG_NAME_LEN);
    status = _rsExecCmd(rsComm, &execCmdInp, &execCmdOut);

    if (status < 0) {
        status = UNIV_MSS_CHMOD_ERR - errno;
        rodsLog (LOG_ERROR, "univMSSFileChmod: cannot chmod for %s, status = %d",
                 name, status);
    }

    return (status);
}
Example #5
0
shared_str	ui_core::get_xml_name(LPCSTR fn)
{
    string_path				str;
    if(!is_16_9_mode()) {
        sprintf(str, "%s", fn);
        if ( NULL==strext(fn) ) strcat(str, ".xml");
    } else {

        string_path			str_;
        if ( strext(fn) )
        {
            strcpy	(str, fn);
            *strext(str)	= 0;
            strcat	(str, "_16.xml");
        } else
            sprintf				(str, "%s_16", fn);

        if(NULL==FS.exist(str_, "$game_config$", "ui\\" , str) )
        {
            sprintf(str, "%s", fn);
            if ( NULL==strext(fn) ) strcat(str, ".xml");
        }
        Msg("[16-9] get_xml_name for[%s] returns [%s]", fn, str);
    }
    return str;
}
Example #6
0
int main(int argc, const char *argv[])
{
    char rule[10][2][81];
    int rule_len[10][2];
    char input[260],tmp[260];
    int n,i,j;
    char *find, *point;
    while( scanf("%d\n",&n) != EOF && n) {
        for ( i = 0 ; i < n ; i++ ) {
            gets(rule[i][0]);
            gets(rule[i][1]);
            rule_len[i][0] = strlen(rule[i][0]);
            rule_len[i][1] = strlen(rule[i][1]);
        }
        gets(input);

        for ( i = 0 ; i < n ; i++ ) {
            while ( find = strstr( input, rule[ i ][ 0 ] ) ) {
                tmp[ 0 ] = 0;
                for ( point = input, j = 0; point != find; ++point, ++j ) {
                    tmp[ j ] = input[ j ];
                }
                tmp[j] = 0;
                strcat(tmp, rule[i][1]);
                strcat(tmp, find + rule_len[i][0]);
                strcpy(input, tmp);
            }
        }
        printf("%s\n", input);
    }
    return 0;
}