Computing.Net > Forums > Programming > C++ - _getcwd() crashes my app!

Computing.Net: Over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to sign up now, it's free!

C++ - _getcwd() crashes my app!

Reply to Message Icon

Original Message
Name: Leo the 28C (by Sulfurik)
Date: September 26, 2005 at 08:00:42 Pacific
Subject: C++ - _getcwd() crashes my app!
OS: Windows XP Home SP2
CPU/Ram: 2.8 GHz/448 MB
Comment:

Hello everyone! :-D
OK, I'm trying to use the _getcwd() function as posted here:

http://code.dreamincode.net/snippet77.htm

But that crashes, so I tried this:

http://www.codeguru.com/forum/archive/index.php/t-84203.html

But that function returns 2 weird Unicode characters... Does anybody know how to do it? Thanks! ;-)

http://www.xthost.info/sulfurik/
http://tsfc.ath.cx
ftp://tsfc.ath.cx
hotline://tsfc.ath.cx

Ruffle Mayo says ROFLMAO! :D


Report Offensive Message For Removal


Response Number 1
Name: egkenny
Date: September 30, 2005 at 23:57:37 Pacific
Reply:

I used Visual C++ 6.0. Both functions worked for me. I used this main to call both functions in turn:

void main()
{
// _MAX_PATH is the maximum length allowed for a path
char CurrentPath1[_MAX_PATH];
LPCSTR CurrentPath2;

// use the 1st function to get the path
GetCurrentPath(CurrentPath1);

// use the 2nd function to get the path
CurrentPath2 = getAppPath();

char temp[_MAX_PATH];
cout << CurrentPath1 << endl;
cout << CurrentPath2 << endl;
cout << "Press Enter to continue";
cin.getline(temp,_MAX_PATH);
}

This was the output:

U:\Testapp
U:\Testapp\Release\



Report Offensive Follow Up For Removal

Response Number 2
Name: Leo the 28C (by Sulfurik)
Date: October 1, 2005 at 16:27:53 Pacific
Reply:

Yeah, I fixed that. Thanks! ;-)

http://www.xthost.info/sulfurik/
http://tsfc.ath.cx
ftp://tsfc.ath.cx
hotline://tsfc.ath.cx

Ruffle Mayo says ROFLMAO! :D


Report Offensive Follow Up For Removal







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home



Results for: C++ - _getcwd() crashes my app!

DOS Variable Help
    Summary: Hello Everybody! I need some help to figure out this: i have a .net email applicaction that runs from command prompt, and it attaches a txt file to the email and sends it. You pass the from, to, subje...
www.computing.net/answers/programming/dos-variable-help/15529.html

Dev C++ kills my system
    Summary: .... Ok. Well I'm back to using Borland C++ builder and I've learned a lot since my earlier post. I still don't know why Dev C++ crashes my system. This may sound dumb but I didn't know how to includ...
www.computing.net/answers/programming/dev-c-kills-my-system/12355.html

c++ - my last two (i hope) issues
    Summary: i've been translating an xp powershell script to c++ to run on my mandriva 2007.1 linux box doing processing of timelapse photos. i've got most of the project completed now and need help on the (ho...
www.computing.net/answers/programming/c-my-last-two-i-hope-issues/16521.html








Which MP3 player do you have?

iPod/iPhone
Zune
Something Else
None


View Results

Poll Finishes In 2 Days.
Discuss in The Lounge
Poll History






Data Recovery Software