Skip to content
MPGHThe Dark Arts
/
RegisterLog in
Forum
Community
What's NewLatest posts across the boardTrendingHottest threads right nowSubscribedThreads you follow
Discussion
GeneralIntroductionsEntertainmentDebate FortFlaming & Rage
Board
News & AnnouncementsMPGH TimesSuggestions & HelpGiveaways
More Sections
Art & Graphic DesignProgrammingHackingCryptocurrency
Hacks & Cheats
Games
ValorantCS2 / CS:GOCall of Duty / WarzoneFortniteApex LegendsEscape From Tarkov
+14 moreLeague of LegendsGTA VMinecraftRustROTMGBattlefieldTroveBattleOnCombat ArmsCrossFireBlackshotRuneScapeDayZDead by Daylight
Resources
Game Hacking TutorialsReverse EngineeringGeneral Game HackingAnti-CheatConsole Game Hacking
Tools
Game Hacking ToolsTrainers & CheatsHack/Release NewsNew
Submit a release →Share your cheat, tool, or config with the community.
AINEW
AI Tools
General & DiscussionPrompt EngineeringLLM JailbreaksHotAI Agents & AutomationLocal / Open Models
AI × Gaming
AI Aimbots & VisionML Anti-CheatGame Bots & Automation
Create
AI Coding / Vibe CodingAI Art & MediaAI Voice & TTS
The AI frontier →Where game hacking meets modern machine learning. Jump in.
Marketplace
Buy & Sell
SellingBuyingTradingUser Services
Trust & Safety
Middleman LoungeMarketplace TalkVouch Copy Profiles
Money
Cryptocurrency TalkCurrency ExchangeWork & Job Offers
Start selling →List accounts, services, and goods. Use the middleman to trade safe.
MPGH The Dark Arts

A community for offensive security research, reverse engineering, and AI.

Community

ForumMarketplaceSearch

Account

RegisterLog in

Legal

Privacy PolicyForum RulesHelp & FAQ
© 2026 MPGH · All rights reserved.Built by the community, for the community. For educational purposes onlyContent is shared for security research and education — we don't condone illegal use. You're responsible for complying with applicable laws. Use at your own risk.
Home › Forum › Programming › C++/C Programming › Getting Current Path of Executable + Adding On a File

Getting Current Path of Executable + Adding On a File

Posts 1–10 of 10 · Page 1 of 1
CoderNever
CoderNever
Getting Current Path of Executable + Adding On a File
I want to get the current path of my executable, and add "Untitled.txt" for I can always instantly know the path to Untitled.txt if its in the same directory as my exe. I also would like the final result as a "char". Any help is appreciated, and trust me I already tried google as well as other basic C++ functions and i could not get it.


Edit : I used the "System::Windows::Forms" namespace to find the path now how would I had Untitled.txt to it.
#1 · edited 16y ago · 16y ago
Void
Void
Damn you made me type this up for nothing. >_>
#2 · 16y ago
CoderNever
CoderNever
Quote Originally Posted by CoderNever View Post
I want to get the current path of my executable, and add "Untitled.txt" for I can always instantly know the path to Untitled.txt if its in the same directory as my exe. I also would like the final result as a "char". Any help is appreciated, and trust me I already tried google as well as other basic C++ functions and i could not get it.


Edit : I used the "System::Windows::Forms" namespace to find the path now how would I had Untitled.txt to it.
I Still need to findout how to add Untitled.txt to it xD .
#3 · 16y ago
Void
Void
[php]
char* GetExecutablePath(char* ExecutableName)
{
//Find process
PROCESSENTRY32 Pe;
Pe.dwSize = sizeof( PROCESSENTRY32 );

HANDLE snapshot = CreateToolhelp32Snapshot(TH32CS_SNAPALL,NULL);

Process32First(snapshot,&Pe);
do {
if( !strcmp(Pe.szExeFile,ExecutableName) )
break;
} while(Process32Next(snapshot,&Pe));

//Find executable module and return path
MODULEENTRY32 Me;
Me.dwSize = sizeof( MODULEENTRY32 );
HANDLEh snapshot = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE,Pe.dw32 thProcessID);

Module32First(hsnapshot,&Me);
do {
if( !strcmp(Me.szModule,Executable) )
return Me.szExePath;
} while(Module32Next(hsnapshot,&Me);
return NULL;
}

int main()
{
char* path = GetExecutablePath("winmine.exe");
char* Filename = "\\Untitled.txt";
path += Filename;

ofstream File(path); //creates if doesn't exist
}
[/php]

Idk if that's going to work, I'm not on Windows, can't test anything..
#4 · edited 16y ago · 16y ago
CoderNever
CoderNever
I'm getting these 2 errors..

Code:
error C2374: 'snapshot' : redefinition; multiple initialization
 see declaration of 'snapshot'
error C2039: 'dw32ProcessID' : is not a member of tagPROCESSENTRY32'
and here is the line there both on...

Code:
 HANDLE snapshot = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE,Pe.dw32ProcessID);
#5 · 16y ago
Void
Void
Edited, try again.
#6 · 16y ago
CoderNever
CoderNever
Handleh, and hSnapshot are not found. then we also get this..
Code:
'dw32thProcessID' : is not a member of 'tagPROCESSENTRY32'

Do you think something like this could work...
Code:
this->textBox1->Text = Windows::Forms::Application::StartupPath->Insert(Windows::Forms::Application::StartupPath->Length,"\untitled.txt");
#7 · edited 16y ago · 16y ago
Hell_Demon
Hell_Demon
doesnt + work in managed C++?

Code:
string a = "LOLWUT";
MessageBox.Show(a+" I AM LEET");
works in c#
#8 · 16y ago
CoderNever
CoderNever
Nope that ain't working. I fixed it though .
#9 · 16y ago
Void
Void
Why in the world are you using managed C++? ):
#10 · 16y ago
Posts 1–10 of 10 · Page 1 of 1

Post a Reply

Similar Threads

  • Getting the path of a running process?By *Marneus901* in C++/C Programming
    0Last post 17y ago
  • I get added from the most...By Skyline. in General
    36Last post 15y ago
  • Ads get upgradeBy -InFinity in General
    12Last post 15y ago
  • how do u get rid of ads on a hack?By machuhoya in Combat Arms Help
    5Last post 16y ago
  • Get Process name, PID, User, PathBy Token in C++/C Programming
    3Last post 17y ago

Tags for this Thread

None