1.c?语言s语言源码???strsub????Դ??
2.如何创建.in文件?
c????strsub????Դ??
#include <stdio.h>
int strat( char *s, char c )
{
while ( *s )
{
if ( *s==c )
return 1;
s++;
}
return 0;
}
char *strsub( char *s, char *q)
{
char *t=s,*new_s=s;
while ( *t )
{
if ( !strat( q, *t) )
*new_s++ = *t ;
t++;
}
*new_s='\0';
return s;
}
void main()
{
char str1[]="abcdefg";
char str2[]="abc" ;
char *p=strsub( str1,str2);
printf("%s\n", p );
}
如何创建.in文件?
public class IniOP
{
#region 声明读写INI文件的API函数
[DllImport("kernel")]
private static extern long WritePrivateProfileString(string section, string key, string val, string filePath);
[DllImport("kernel")]
private static extern int GetPrivateProfileString(string section, string key, string def, StringBuilder retVal, int size, string filePath);
#endregion
#region 变量声明
//初始化路径名,主键名,函函数字符串长度,数源这里需要加一个说明,在对应函数才需要做类似操作,语言s语言源码分时vol源码初始值应该为空
private string m_strFilePath = "";
private string m_strKey = "";
private string m_strSubKey = "";
private int m_intSize = ;
private string _strFilePath = System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + @"\Default.ini";
private string _strKey = "ErrorKeyIsNull";
private string _strSubKey = "ErrorSubKeyIsNull";
#endregion
#region 属性设置
//设置路径属性
public string FilePath { get { return m_strFilePath; } set { m_strFilePath = value; } }
//设置主键名属性
public string Key { get { return m_strKey; } set { m_strKey = value; } }
//设置字符串长度属性
public int Size { get { return m_intSize; } set { m_intSize = value; } }
//设置子键名属性
public string SubKey { get { return m_strSubKey; } set { m_strSubKey = value; } }
//版本信息
public static string Version
{
get
{
return System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();
}
}
#endregion
#region 构造函数
//构造函数,函函数无参数
public IniOP()
{
}
//构造函数,数源路径名
public IniOP(string strPath)
{
m_strFilePath = strPath;
}
//构造函数,语言s语言源码路径名,函函数主键名
public IniOP(string strPath,数源 string strKey)
{
m_strFilePath = strPath;
m_strKey = strKey;
}
//构造函数,路径名,语言s语言源码主键名,函函数文玩拍卖源码程序字符串长度
public IniOP(string strPath,数源 string strKey, int intSize)
{
m_strFilePath = strPath;
m_strKey = strKey;
m_intSize = intSize;
}
//构造函数,路径名,语言s语言源码主键名,函函数字符串长度,数源子键名
public IniOP(string strPath,IT源码下载网站 string strKey, int intSize, string strSubKey)
{
m_strFilePath = strPath;
m_strKey = strKey;
m_intSize = intSize;
m_strSubKey = strSubKey;
}
#endregion
#region 写入ini文件时的默认值判断
private void IniCheckDefaultValue()
{
if (m_strFilePath == "" || System.IO.File.Exists(m_strFilePath) == false)
{
_strFilePath = System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + @"\Default.ini";
}
else
{
_strFilePath = m_strFilePath;
}
if (m_strKey == "")
{
_strKey = "ErrorKeyIsNull_" + System.DateTime.Now.ToString("yyyyMMddHHmmss");
}
else
{
_strKey = m_strKey;
}
if (m_strSubKey == "")
{
_strSubKey = "ErrorSubKeyIsNull_" + System.DateTime.Now.ToString("yyyyMMddHHmmss");
}
else
{
_strSubKey = m_strSubKey;
}
}
#endregion
#region 写入文件函数(非静态)
//写INI文件,输入键值
public void WriteValue(string strValue)
{
IniCheckDefaultValue();
WritePrivateProfileString(_strKey, _strSubKey, strValue, _strFilePath);
}
//写INI文件,输入子键名,键值
public void WriteValue(string strSubKey, string strValue)
{
IniCheckDefaultValue();
WritePrivateProfileString(_strKey, strSubKey, strValue, _strFilePath);
}
//写INI文件,输入主键名,子键名,源码站 风险键值
public void WriteValue(string strKey, string strSubKey, string strValue)
{
IniCheckDefaultValue();
WritePrivateProfileString(strKey, strSubKey, strValue, _strFilePath);
}
//写INI文件,输入主键名,子键名,文件路径,键值
public void WriteValue(string strKey,支付通道源码分享 string strSubKey, string strPath, string strValue)
{
WritePrivateProfileString(strKey, strSubKey, strValue, strPath);
}
#endregion
#region 写入文件函数(静态)
//写INI文件,输入主键名,子键名,文件路径,键值
public static void staticWriteValue(string strKey, string strSubKey, string strPath, string strValue)
{
WritePrivateProfileString(strKey, strSubKey, strValue, strPath);
}
#endregion
#region 读取文件函数(非静态)
//读取INI文件,所有参数提前设置好
public string ReadValue()
{
StringBuilder strTemp = new StringBuilder(m_intSize);
int i = GetPrivateProfileString(m_strKey, m_strSubKey, "", strTemp, m_intSize, m_strFilePath);
return strTemp.ToString();
}
//读取INI文件,输入子键名
public string ReadValue(string strSubKey)
{
StringBuilder strTemp = new StringBuilder(m_intSize);
int i = GetPrivateProfileString(m_strKey, strSubKey, "", strTemp, m_intSize, m_strFilePath);
return strTemp.ToString();
}
//读取INI文件,输入主键名,子键名
public string ReadValue(string strKey, string strSubKey)
{
StringBuilder strTemp = new StringBuilder(m_intSize);
int i = GetPrivateProfileString(strKey, strSubKey, "", strTemp, m_intSize, m_strFilePath);
return strTemp.ToString();
}
//读取INI文件,输入主键名,子键名,文件路径
public string ReadValue(string strKey, string strSubKey, string strPath)
{
StringBuilder strTemp = new StringBuilder(m_intSize);
int i = GetPrivateProfileString(strKey, strSubKey, "", strTemp, m_intSize, strPath);
return strTemp.ToString();
}
//读取INI文件,输入主键名,子键名,取字符串长度
public string ReadValue(string strKey, string strSubKey, int intSize)
{
StringBuilder strTemp = new StringBuilder(intSize);
int i = GetPrivateProfileString(strKey, strSubKey, "", strTemp, intSize, m_strFilePath);
return strTemp.ToString();
}
//读取INI文件,输入主键名,子键名,文件路径,取字符串长度
public string ReadValue(string strKey, string strSubKey, string strPath, int intSize)
{
StringBuilder strTemp = new StringBuilder(intSize);
int i = GetPrivateProfileString(strKey, strSubKey, "", strTemp, intSize, strPath);
return strTemp.ToString();
}
#endregion
#region 读取文件函数(静态)
//读取INI文件,输入主键名,子键名,文件路径,取字符串长度
public static string staticReadValue(string strKey, string strSubKey, string strPath, int intSize)
{
StringBuilder strTemp = new StringBuilder(intSize);
int i = GetPrivateProfileString(strKey, strSubKey, "", strTemp, intSize, strPath);
return strTemp.ToString();
}
#endregion
}
//