int main(int argc, char * argv[]) { int ind, i,length; char *num, *infile = argv[1]; char *outfile = argv[2]; int *intarray; length = atoi(argv[3]); intarray = (int *) malloc((length+1)* sizeof(int)); FILE *fp = fopen(infile, "r"); for(ind =0; ind < length; ind++) fscanf(fp, "%d\n", &intarray[ind]); intarray[length] = 0; fclose(fp); ind = sarray(intarray, length+1); fp =fopen(outfile, "w"); for(i=0; i<length+1; i++) fprintf(fp, "%d\n", intarray[i]); fclose(fp); free(intarray); return(0); }
//------------------------------------------------------------------------------------ Ogre::TextureUnitState *MaterialService::createAnimatedTextureState( Pass *pass, const String &baseTextureName, const String &resourceGroup, float fps) { // // Texture unit state for the main texture... TextureUnitState *tus = pass->createTextureUnitState(baseTextureName); // if if was found, then we'll proceed by enumerating all the resources with // the same name, but with _NUMBER auto mat_textures = getAnimTextureNames(baseTextureName, resourceGroup); // if we have anim. textures: if (mat_textures.size() > 1) { // convert to String* array size_t size = mat_textures.size(); std::unique_ptr<String[]> sarray(new String[size]); size_t i = 0; for (const String &s : mat_textures) { sarray[i++] = s; } tus->setAnimatedTextureName(sarray.get(), size, size / fps); } return tus; }