in Education by
There are two strings in a program. Each of them contains a path to some file or folder. How can I check in C++ whether these paths are to the same file/folder? Can I use the Windows API to do this? JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
You might use Boost Filesystem. It has the added weight of being cross-platform; this is obviously also a potential advantage. Note the bolded API reference below in case you want to check it out: GetFileInformationByHandle. equivalent bool equivalent(const path& p1, const path& p2); bool equivalent(const path& p1, const path& p2, system::error_code& ec); Effects: Determines file_status s1 and s2, as if by status(p1) and status(p2), respectively. Returns: true, if sf1 == sf2 and p1 and p2 resolve to the same file system entity, else false. Two paths are considered to resolve to the same file system entity if two candidate entities reside on the same device at the same location. This is determined as if by the values of the POSIX stat structure, obtained as if by stat() for the two paths, having equal st_dev values and equal st_ino values. [Note: POSIX requires that "st_dev must be unique within a Local Area Network". Conservative POSIX implementations may also wish to check for equal st_size and st_mtime values. Windows implementations may use GetFileInformationByHandle() as a surrogate for stat(), and consider "same" to be equal values for dwVolumeSerialNumber, nFileIndexHigh, nFileIndexLow, nFileSizeHigh, nFileSizeLow, ftLastWriteTime.dwLowDateTime, and ftLastWriteTime.dwHighDateTime. -- end note] Throws: filesystem_error if (!exists(s1) && !exists(s2)) || (is_other(s1) && is_other(s2)), otherwise as specified in Error reporting.

Related questions

0 votes
    There are two strings in a program. Each of them contains a path to some file or folder. How can ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 2, 2022 in Education by JackTerrance
0 votes
    There are two strings in a program. Each of them contains a path to some file or folder. How can ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 2, 2022 in Education by JackTerrance
0 votes
    I see many user interface control libraries for .NET, but where can I get similar stuff for win32 using ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 25, 2022 in Education by JackTerrance
0 votes
    I'm working on some idea connected with RS-232 interface manipulation. I can open this port, configure it ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 13, 2022 in Education by JackTerrance
0 votes
    Do any C++ GNU standalone classes exist which handle paths cross platform? My applications build on Windows ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 23, 2022 in Education by JackTerrance
0 votes
    Do any C++ GNU standalone classes exist which handle paths cross platform? My applications build on Windows ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 23, 2022 in Education by JackTerrance
0 votes
    Do any C++ GNU standalone classes exist which handle paths cross platform? My applications build on Windows ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 23, 2022 in Education by JackTerrance
0 votes
    How many messages does the queue for a standard window hold? What happens when the queue overflows? The ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 19, 2022 in Education by JackTerrance
0 votes
    I'm using a 3rd party DLL written in unmanaged C++ that controls some hardware we have. Unfortunately ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 11, 2022 in Education by JackTerrance
0 votes
    I'm using a 3rd party DLL written in unmanaged C++ that controls some hardware we have. Unfortunately ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 11, 2022 in Education by JackTerrance
0 votes
    I'm using a 3rd party DLL written in unmanaged C++ that controls some hardware we have. Unfortunately ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 5, 2022 in Education by JackTerrance
0 votes
    I'm using a 3rd party DLL written in unmanaged C++ that controls some hardware we have. Unfortunately ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 5, 2022 in Education by JackTerrance
0 votes
    ______ finds K best paths in a given graph. (a) kBestShortestPaths (b) kcirt (c) ktrees (d) kmap The ... Regression of R Programming Select the correct answer from above options...
asked Feb 10, 2022 in Education by JackTerrance
0 votes
    I've just started writing unit tests for a legacy code module with large physical dependencies using the ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 25, 2022 in Education by JackTerrance
0 votes
    I've just started writing unit tests for a legacy code module with large physical dependencies using the ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 24, 2022 in Education by JackTerrance
...