10-26-2009 04:10 PM
Hi I just need help with my logic for a two step process.
the first step to process is complete. which is writing my centroid point to a text file.
the second process I need a lil assistance taking the centriod point I just wrote and send it to back to any particular function I choose.
I just need a lil assistance for the second process. which is getting the x, y value back out and just sending it out to a particular function.
in the script file you see a BORESIGHT_READ , sets the centoid pixel range so thats the easy part, which i know how to do.
the BORESIGHT_WRITE is the actual centroid point that I have to send out to a particular function or write back out from the text file that Im posting.
I just need a Logic that i can follow if this is not already done.
10-26-2009 04:51 PM
Darnell:
Our firewall doesn't let me download .scr files (thinking they might be potentially harmful scripts). Can you repost them as .txt files?
What is the format of the data in your text data file?
Can you post a sample line from your text file?
The logic is the following:
Open the text file for reading.
Read a line of text.
Parse the data from the line of text.
Pass the data to the function that will use it.
...
Close the text file.
Depending on the format of your data, you may be able to read the line of text and parse the data in one step using a ANSI C library function like fscanf().
10-26-2009 10:56 PM
this is the text file, if you cant downwload it, open the text file or ini file in notepad.
in the text file you will see x=320, and y=240.
I will take a and centroid value and subtract it from the x and y value which is going to be the offset.
basically i want to write a centroid point to the ini file or text file.
then afterwards im going to grab the height and width and subtract it from the config file to get a offset.
once i get the offset x and y, send those values to the other text file which is offset.txt file.
then im going to grab the offset value from the text file and send it to anytype of function that i please.
10-26-2009 11:10 PM
10-27-2009 12:26 AM
I know how to do it using the GetPrivateProfileString(); in windows,im trying to learn how to do it with cvi inifile.fp
i havent got it work yet with inifile.fp functions
char iniFile[MAX_PATHNAME_LEN];
char iniFilePath[MAX_PATHNAME_LEN]={"C:\\Documents and Settings\\z1083774\\Desktop\\config file"};
char sSection[][30] ={0};
char sTag[][30] = {"frameWidth",
"frameHeight"};
char statPathName[MAX_PATHNAME_LEN] = ""; ///< Pathname for the station INI file.
HRESULT hr;
IniText iniStation = 0; ///< Handle for the Station INI file.
char section[80];
int frameWidth=320;
int frameHeight=240;
// Load the station information file
Ini_Dispose( iniStation );
iniStation = Ini_New( 0 );
strcpy( section, "DAS" );
Ini_PutInt (iniStation, section, "frameWidth", frameWidth);
Ini_PutInt (iniStation, section, "frameHeight", frameHeight);
10-27-2009 12:58 AM
nevermind I found what i was doing wrong. this is the code i have now
GetProjectDir (dirName);
MakePathname (dirName, "Config.ini", pathName);
Ini_Dispose( iniStation );
iniStation = Ini_New( 0 );
Ini_PutInt (iniStation, "DAS", "frameWidth", frameWidth);
Ini_PutInt (iniStation, "DAS", "frameHeight", frameHeight);
Ini_WriteToFile (iniStation, pathName);
system("notepad Config.ini");
10-27-2009 01:00 AM
OK. And then?? Till now you are handling an object in memory. If you want to have a copy on disk you will need to write it somewere: use Ini_WriteToFile for this.
As a side note, it's better that you add error checking at least to Ini_Create and Ini_WriteToFile functions, which are the most critical as they deal with memory allocation and file I/O.
Do you get any error till now?
10-27-2009 01:10 AM
10-27-2009 01:46 AM
10-28-2009 01:33 AM
Hi Im using this logic, I having a problem, everytime I run the program, the program creates a new ini file, instead of just outting the values in without
erasing the entire file. do you know why is that ?
GetProjectDir(directoryPathName);
MakePathname(directoryPathName,CONFIG_FILE2,iniFilePathName);
Ini_Dispose(iniStationController);
iniStationController=Ini_New( 0 );
Ini_PutInt(iniStationController, "DAS", "X_BORESIGHT", offSetXposition);
Ini_PutInt(iniStationController, "DAS", "Y_BORESIGHT", offSetYposition);
Ini_WriteToFile(iniStationController, iniFilePathName);