Hello all,

I am having a problem with an endless loop that i only discovered
when i inserted a printf into the loop.
I have packed it into a function, all you have to do is create a little
program and call fDoTest() from main.

The function should remove the path leaving the filename
then remove the .wmb extension from filename and add .gsx
extension to the filename.

 Code:
// filled for testing - usually comes from fileselect dialog
char* filePathName = "D:\\GSTUDIO PROJECTS\\A7_PROJECTS\\PROJECTTEST\\atestfile.wmb";   // 
//
STRING* aCurrentPath = " ";
aCurrentPath = str_create("aCurrentPath");
STRING* camPosName_str = " ";  
camPosName_str = str_create("camPosName_str");

///////////////////////////////////////////////////////////////
function fDoTest()
{
	
draw_text("in fDoTest()",500,200,_vec(0,255,0 ));
	
	int i = 0, j=0;
	int count=0, len=0;
	int pcount = 0;
	// THIS LOOP seems to never end ????????????
	// is strange - only found out whilst debugging
	// yet app works (at least up to now) 
	// but is definately not right
	// if i insert a printf in the while loop then i notice it	
	while (str_stri(_str(filePathName),"*") == 0)
	{	            
		// search for "\" until no more
		len = str_len(_str(filePathName));
		count = str_stri(_str(filePathName),"\\");
		pcount = len-count;					
		// clip name from begin to "\"
		str_clip(_str(filePathName),count);
 		// trunc name from end by (pcount - to "\") dont work ????
		str_trunc(_str(aCurrentPath),pcount );				
	        // store levelname
		str_cpy(camPosName_str,_str(filePathName));	
		// split levelname. from ext (wmb))
		len = str_len(camPosName_str); 
		count = str_stri(camPosName_str,"."); // search for "."
		count = (len - count);
		str_trunc(camPosName_str,count);						
		//  
		// add file ext (gsx) )
		str_cat(camPosName_str,"gsx");	
		//
		//
// UN-COMMENT next line to see printf in endless loop
// and i have to end printf in task manager
// yet COMMENTED runs ok
//printf("camPosName_str= %s",_chr(camPosName_str));		
		//
      wait(1);
   }
   // DOES NOT seem to get to here
   printf("aCurrentPath= %s",_chr(aCurrentPath));   
   printf("camPosName_str= %s",_chr(camPosName_str));
   
   return;
} 


Thanks for any help. I just cant see (at this time) the reason.


A8.3x Commercial, AcknexWrapper and VS 2010 Express
○pararealist now.