分离路径

#include <windows.h>
#include <iostream.h>
#include "Shlwapi.h"

void main( void )
{

    // Path to include file spec.
char buffer_1[ ] = "C:\\TEST\\sample.txt"; 
char *lpStr1;
lpStr1 = buffer_1;

    // Print the path with the file spec.
cout << "The path with file spec is          : " << lpStr1 << endl;
 
    // Call to "PathRemoveFileSpec".
PathRemoveFileSpec(lpStr1);

// Print the path without the file spec.
cout << "\nThe path without file spec is       : " << lpStr1 << endl;

}
OUTPUT:
==================
The path with file spec is          : C:\TEST\sample.txt

The path without file spec is       : C:\TEST

你可能感兴趣的:(c,File,buffer,Path,include,output)