CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (http://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   A realy easy variable - problem (http://www.cfd-online.com/Forums/openfoam-programming-development/111351-realy-easy-variable-problem.html)

wernsen January 4, 2013 09:41

A realy easy variable - problem
 
Hey guys,

I am going crazy. Here the code:

Code:

forAll(pSampledPlaneList, pI)
{
      pSampledPlaneList[pI]().update();
      fileName fname("plane_" + word(pI) + ".obj");
      pSampledPlaneList[pI]().write(fname);
}

I am a having planeList and I want to write them down. It works but there is a problem with the file name. The output looks like this: plane_?.obj

I think there is a problem with the variable type but I cannot solve it.

Thanks for any hint...
martin

l_r_mcglashan January 4, 2013 12:36

Code:

fileName fname("plane_" + name(pI) + ".obj");

wernsen January 7, 2013 11:43

thanks alot it works. But can you tell me how can I find out this the next time by my own? Just a few hints would be nice.

l_r_mcglashan January 7, 2013 14:25

Not sure, I just know it, but I often use grep to try and find out if there's already something similar to what I want to do around. You could have done the following search:

Code:

grep -e "fileName.*(*.obj" -R .
and one of the hits gives:
Code:

fileName cutsFile("hexCellLooper_" + name(cellI) + ".obj");


All times are GMT -4. The time now is 05:04.