CAPL Script

SetFilePath

Note This function is not available in case of adistributed environment.

Syntax

void setFilePath (char Path[],dword mode);

Function

This function sets the read and writepathto the directory. The path can be given as absolute or relative to the currently active configuration.

Parameters

Path

Return Values

//set directory for readingsetFilePath("C:\\Windows\\TEMP", 0);//set directory for writingsetFilePath("D:\\TEMP", 1);//set directory for writing and readingsetFilePath("C:\\TEMP", 2);on key 'i'{int defaultPara1;int returnParaInt;int counter;double defaultPara2;double returnParaFloat;char buffer [256];//define symbolic values for read/write access modedword FILE_PATH_R   = 0;dword FILE_PATH_W   = 1;dword FILE_PATH_RW  = 2;defaultPara1 = -1;defaultPara2 = -1;//set absolute file path for writingsetFilePath("C:\\TEMP" , FILE_PATH_W);// Write different values into the section "Parameter" of the INI file "Test.INI"// If no file path is specified, the path from previous setFilePath command is usedwriteProfileString ("Parameter","String","TestString","Test.INI");writeProfileFloat ("Parameter","Float", 1.7845,"Test.INI");writeProfileInt ("Parameter", "Integer", 8, "Test.INI");// Read different values from the Section "Parameter" of the INI file "C:\\temp\\Test.INI"// And display the values in the Write Window//if an absolute path is to be used, this can be coded in the parameter <filename> directlyreturnParaInt = getProfileInt("Parameter","Integer",defaultPara1,"C:\\TEMP\\Test.INI");returnParaFloat = getProFileFloat("Parameter","Float",defaultPara2,"C:\\TEMP\\Test.INI");getProFileString("Parameter","String","Default String", buffer, elcount(buffer), "C:\\TEMP\\Test.INI");write("Integer: %d", returnParaInt);write("Float: %f", returnParaFloat);write("String: %s", buffer);}