linux realpath 移植

使用windows下的_fullpath函数

// crt_fullpath.c  
// This program demonstrates how _fullpath  
// creates a full path from a partial path.  
  
#include   
#include   
#include   
#include   
  
void PrintFullPath( char * partialPath )  
{  
   char full[_MAX_PATH];  
   if( _fullpath( full, partialPath, _MAX_PATH ) != NULL )  
      printf( "Full path is: %s\n", full );  
   else  
      printf( "Invalid path\n" );  
}  
  
int main( void )  
{  
   PrintFullPath( "test" );  
   PrintFullPath( "\\test" );  
   PrintFullPath( "..\\test" );  
}


参考:

https://baike.baidu.com/item/realpath/2895213?fr=aladdin

http://blog.csdn.net/earbao/article/details/51941696

http://blog.csdn.net/tujiaw/article/details/7871547

https://msdn.microsoft.com/en-us/library/506720ff.aspx

你可能感兴趣的:(软件,移植,linux,windows)