In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)05/31 Report--
This article introduces the relevant knowledge of "how to get the current path in C++". In the operation of actual cases, many people will encounter such a dilemma. Then let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
1. The following code is from CSDN 2004 VC programming experience summary.
{CString strPath; GetCurrentDirectory (MAX_PATH,strPath.GetBuffer (MAX_PATH)); strPath.ReleaseBuffer (); return strPath;}
2. The following code is from TZ MFC.NET Primer 1.01
CString CPropertyGridSampleApp::GetCurrWorkingDir () {CString strPath; TCHAR szFull [_ MAX_PATH]; TCHAR szDrive [_ MAX_DRIVE]; TCHAR szDir [_ MAX_DIR];: GetModuleFileName (NULL, szFull, sizeof (szFull) / sizeof (TCHAR)); _ tsplitpath (szFull, szDrive, szDir, NULL, NULL); _ tcscpy (szFull, szDrive); _ tcscat (szFull, szDir); strPath = CString (szFull); return strPath;}
The code that uses the * * segment C++ to get the current path can get the directory where the application is running. However, because the real host is IDE when you compile and run the project using Microsoft Visual Studio.NET, the current directory is the project directory, not the DEBUG or RELEASE directory, which requires the developer's attention. The second piece of code can solve this problem dynamically. And added Unicode support (TCHAR).
That's all for "how to get the current path in C++". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.