avelec

Current status: "I'm creating my first project using C++ Builder 2009 Professional. When I obtain the current working directory using 'getcwd(' I get the pathway with the word 'Debug' appended to it. If I strip off the 'Debug' so that the pathway appears correct , save it to disk and then open the file again and read the contents I find that the pathway has again got 'Debug' appended to it. Why is this happening?" - 7 years ago
Member since: Sunday, 22 May 2016
Last login: 4 years ago
Profile viewed: 416 views

No Rank
Points: 0

avelec replied to the topic ''getcwd()' gives path appended with 'Debug'' in the forum. 7 years ago

Hello Agus,
Thank you for coming back again. The program files I am creating lie in the same directory as the project (.cbproj) file and are located in partition F: in my computer. However, C++ Builder 2009 itself is installed in a different disk partition,( E:). The same arrangement seems to work OK for a previous program written with Builder 4 and getcwd() does not misbehave there. However, with Builder 2009 not only do I get the "Debug" appended to the path string but I now find that merely invoking getcwd() causes some kind of error that corrupts data that my program subsequently writes to the screen via some Memos on my form.
Although I have manuals relating to older versions of C++ Builder I do not have any relating specifically to C++ Bulder 2009 so I am wondering if there has been some change that I have missed.

Read More...

avelec replied to the topic ''getcwd()' gives path appended with 'Debug'' in the forum. 7 years ago

- forgot to add that I have got around the same problem occurring when writing to the disk file. I was making an error there and curing it has removed the problem although I still get it when using getcwd() as described above.

Read More...

avelec replied to the topic ''getcwd()' gives path appended with 'Debug'' in the forum. 7 years ago

Thank you, Agus, for responding to my post sp promptly. I am relatively inexperienced with C++ Builder although I have done some work with a previous version (version 4) and am trying to use some of the same code to build a new application using the 2009 version. I am trying to establish proof that I can save the pathway corresponding to a data file's location to disk and then read it later in order to locate the data file again. I am using this code:
#include <dir.h>
char *pathway;
getcwd(pathway,MAXPATH);
- and I get the correct path in *pathway but with "\\Debug" stuck on the end of it. I can easily remove it but I think I must be dong something wrong so would sooner prevent the problem.

Read More...

avelec created a new topic ' 'getcwd()' gives path appended with 'Debug'' in the forum. 7 years ago

I'm creating my first project using C++ Builder 2009 Professional. When I obtain the current working directory using 'getcwd(' I get the pathway with the word 'Debug' appended to it. If I strip off the 'Debug' so that the pathway appears correct , save it to disk and then open the file and read the contents I find that the pathway has again got 'Debug' appended to it. Why is this happening and how can I stop it?

Read More...

I'm creating my first project using C++ Builder 2009 Professional. When I obtain the current working directory using 'getcwd(' I get the pathway... Show more