Save work-directory in the registry?

I have made a program that builds on an access database(mdb). Now I want to store the workning directory and name for the database in some way ... should I use the registry?

How do I put that in the registry, please give me a code example ...
Thanks :-)
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

bert1Author Commented:
Btw, im using MSV C++ 6.0 and working as much as possible with winapi commands ...
Next is my code for make it
int Test(void)
  int bStop = 0;
      // skip registry key opening sequence for clarity
  const INT nSIZE = 4096; //maximum(real 8)
  const DWORD dwLen = 8;
  const char *lpszPathName = "SOFTWARE\\COMPANY\\MYCOMPANY";
  const char *pszValueName = "Param01";

  DWORD dwType;
  DWORD dwData  = nSIZE;
  char* bData   = (char *)::calloc(nSIZE, sizeof(char));
  struct date dDate;
  LONG retValue;

//open key
  retValue = ::RegOpenKeyEx(hBaseKey, lpszPathName,
       NULL, KEY_ALL_ACCESS,&hKey);
  if (retValue != ERROR_SUCCESS)//no such : 1-st time
    {                           //create key
       uint32 disposition;
       retValue = ::RegCreateKeyEx(hBaseKey, lpszPathName, 0, ""/*class*/,
    0/*SecurityAttributes*/, &hKey,
       if (retValue == ERROR_SUCCESS)//must be!
    //you code for form bData
//save data
   ::RegSetValueEx(hKey, pszValueName, 0, REG_BINARY,
  (LPBYTE)bData, dwLen);
   ::RegCloseKey(hKey); //close key
  else //exist, read data
      retValue = ::RegQueryValueEx(hKey, pszValueName,
  NULL, &dwType,(LPBYTE)bData, &dwData);

       if (retValue == ERROR_SUCCESS && REG_BINARY == dwType)
   if (Empty(bData)) //no data?
       //you code for form bData
// Save
      ::RegSetValueEx(hKey, pszValueName, 0, REG_BINARY,
  (LPBYTE)bData, dwLen);
   else  //test data

      ::RegCloseKey(hKey); //close key
  if (bData)
    free (bData);
  return bStop;

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.