コード例 #1
0
ファイル: main.cpp プロジェクト: drmonkeysee/CppTestArena
void structDeclarations()
{
    foo f;
    f.v = 8;
    struct foo f2;
    f2.v = 8;
    
    struct {
        int f;
    } bar;
    bar.f = 8;
    
    alt_blarg b;
    b.b = 8;
    blarg b2;
    b2.b = 8;
    struct blarg b3;
    b3.b = 8;
    
    //fors s; // fors is a function
    struct fors s;
    s.s = 8;
    fors();
    
    func_or_struct fs;
    fs.s = 8;
    
    // rvalue ctor result
    func_or_struct();
    
    //bort b; // bort is a function
    class bort brt;
    brt.r = 10;
    bort();
}
コード例 #2
0
ファイル: cwbmg.c プロジェクト: CazYokoyama/wrfv3
void cwbmg( char *bmg, f77int *nmb, f77int *iret )
{
    char errstr[129];

/*
**  Make sure that a file is open for writing.
*/
    if ( pbf[1] == NULL ) {
	sprintf( errstr, "BUFRLIB: CWBMG - NO FILE IS OPEN FOR WRITING" );
        bort( errstr, ( f77int ) strlen( errstr ) );
    }
/*
**  Write the BUFR message to the file.
*/
    *iret = ( ( fwrite( bmg, 1, *nmb, pbf[1] ) == *nmb ) ? 0 : -1 );

    return;
}
コード例 #3
0
ファイル: cobfl.c プロジェクト: ArielleBassanelli/gempak
void cobfl( char *bfl, char *io )
{
    char lbf[MXFNLEN+1];
    char lio;

    char errstr[129];

    char foparg[3] = " b";  /* 3rd character will automatically
			       initialize to NULL */
    unsigned short i, j;

/*
**  Copy the input arguments into local variables and check them for validity.
**  This is especially important in case either of the arguments was passed in
**  as a string literal by the calling program or else doesn't have a trailing
**  NULL character.
*/
    for ( i = 0; ( ! isspace( bfl[i] ) && ! iscntrl( bfl[i] ) ); i++ ) {
	if ( i == MXFNLEN ) {
	    sprintf( errstr, "BUFRLIB: COBFL - INPUT FILENAME CONTAINS"
			    " MORE THAN %d CHARACTERS", MXFNLEN );
	    bort( errstr, ( f77int ) strlen( errstr ) );
	}
	lbf[i] = bfl[i];
    }
    lbf[i] = '\0';

    lio = io[0];
    if ( ( foparg[0] = (char) tolower( lio ) ) == 'r' ) {
	j = 0;
    }
    else if ( foparg[0] == 'w' ) {
	j = 1;
    }
    else {
	sprintf( errstr, "BUFRLIB: COBFL - SECOND ARGUMENT WAS (%c),"
			" WHICH IS AN ILLEGAL VALUE", lio );
	bort( errstr, ( f77int ) strlen( errstr ) );
    }

/*
**  If a file of this type is already open, then close it before
**  opening the new one.
*/
    if ( pbf[j] != NULL ) fclose( pbf[j] );

/*
**  Open the requested file.
*/
    if ( ( pbf[j] = fopen( lbf, foparg ) ) == NULL ) {
	sprintf( errstr, "BUFRLIB: COBFL - COULD NOT OPEN FILE %s", lbf );
	bort( errstr, ( f77int ) strlen( errstr ) );
    }

/*
**  Call wrdlen to initialize some important information about the
**  local machine, just in case it hasn't already been called.
*/
    wrdlen( );
    
    return;
}