943,879 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Marked Solved
  • Views: 599
  • C++ RSS
Dec 5th, 2008
0

problems with my program installed on Vista

Expand Post »
I have developed a program in an XP enviroment using Borland Builder 6. It has since been installed on a computer with Vista. The program opens text files which are stored in the root directory of the program. The pathname is set in global constants like "name.txt". This works fine in XP but in Vista the program runs OK at first, then loses the files when required a second time. I have traced all the files and they reside in the same directory as the exe file so the impression I have now is that Vista must be running the exe file from another position. At one point even data in the DB was disappearing and returning later, which suggests there were two instances of the database running, however I am still confused as to how this could happen, and haven't been able to recreate this problem yet to investigate further. I suppose my questions are has anyone else experienced something similar, is my compiler outdated for the Vista enviroment, have I forgotten something fundamental regarding streaming text files. I am not sure which direction to take to look for a solution. Regards Nev.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
kodak is offline Offline
12 posts
since Dec 2008
Dec 5th, 2008
0

Re: problems with my program installed on Vista

If you define relative file name (not full path - for example, "name.txt" only) then it's not a Vista problem. At run-time the current directory is not the same as exe module directory so the program can't access external files via relative file names.
Reputation Points: 1234
Solved Threads: 347
Postaholic
ArkM is offline Offline
2,001 posts
since Jul 2008
Dec 5th, 2008
0

Re: problems with my program installed on Vista

Thanks, however hardcoding a full pathname doesn't seem to be a very elegant solution. I haven't experienced this before in XP where I have distributed several programs using relative pathnames without incident. Currently the problem is only appearing on the Vista platform and runs perfectly on my XP. How would I stream a file from an unknown directory? And I still don't comprehend why the program finds the file in the first instance and then loses it subsequently until I close and rerun the program. I shall investigate more so I can refine the symptoms better.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
kodak is offline Offline
12 posts
since Dec 2008
Dec 5th, 2008
0

Re: problems with my program installed on Vista

It appears as if you might have stumbled upon the virtualization feature of Windows Vista. Try looking it up on the MSDN.
Reputation Points: 1105
Solved Threads: 389
Posting Virtuoso
mitrmkar is offline Offline
1,714 posts
since Nov 2007
Dec 5th, 2008
0

Re: problems with my program installed on Vista

Hey Thanks,
you may be onto something here so I shall do what you suggest. I haven't had a lot to do with Vista. Further to my prior posts, I have now borrowed a laptop with vista installed, installed my program and it seems to run fine so far. The only other thing I can think of is the program corrupted somehow during the install, but I do not have access to the computer to test this theory currently. I think I'll mark this as solved, thanks to you both for giving me direction. Much appreciated.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
kodak is offline Offline
12 posts
since Dec 2008
Dec 5th, 2008
0

Re: problems with my program installed on Vista

Better use GetModuleFileName Windows API function to get exe module full path. In that case you can safely access all files placed in the same directory. It's a classical approach (a very elegant solution )...
Reputation Points: 1234
Solved Threads: 347
Postaholic
ArkM is offline Offline
2,001 posts
since Jul 2008
Dec 5th, 2008
0

Re: problems with my program installed on Vista

ArkM, Although using GetModuleFileName won't help in this case. Unless I misunderstood the reams I read last night, Vista virtualization copies my text file to a virtual folder, so it turns out I was reading the original and writing to the copy, hence my thoughts about two instances running at once! I don't think it is supposed to work like that but in my case it certainly appeared to be. Once I get hold of the Vista laptop I can see if in fact this is the case.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
kodak is offline Offline
12 posts
since Dec 2008

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: LoadImage to array
Next Thread in C++ Forum Timeline: Merge sort algorithm?





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC