第28月第3天 c语言读写文件

1.

int ConfigIniFile::OpenFile( const char* szFileName )
{
FILE *fp;
size_t nLen;
int nRet;
CloseFile();
if ( == szFileName )
{
return -;
}
#if defined(_WIN32)
m_szFileName = _strdup( szFileName );
#else
m_szFileName = strdup( szFileName );
#endif
fp = fopen( m_szFileName, "rb" );
if ( == fp )
{
return -;
}
nRet = fseek( fp, 0L, SEEK_END );
if (nRet != )
{
fclose( fp );
return -;
}
nLen = (size_t) ftell( fp );
m_szContent = (char* ) new char[ nLen + ];
m_szShadow = (char* ) new char[ nLen + ];
if ( m_szShadow == || m_szContent == )
{
fclose( fp );
return -;
}
nRet = fseek( fp, 0L, SEEK_SET );
if ( != nRet )
{
fclose( fp );
return -;
}
m_nSize = fread( m_szContent, , nLen, fp );
m_szContent[m_nSize] = '\0';
memcpy( m_szShadow, m_szContent, m_nSize + );
ToLower( m_szShadow, m_nSize + );
fclose( fp );
m_bOpen = true;
return ;
}

http://blog.51cto.com/7666425/1264690

https://github.com/huhu4017/hello-world/blob/c5a345a1bfeedf2a84744d2f3c5da37fc05ad67d/common/ConfigIniFile.cpp

2.nsstring char *

然后再NSString内搜索:const char ,找到两个:1.[string UTF8String]  2.[string cStringUsingEncoding:<#(NSStringEncoding)#>]

https://blog.csdn.net/u012681458/article/details/50378593

上一篇:敦泰FT6X06单层自容调屏


下一篇:python 变量命名规范