C语言的文件操作
#信用卡还款参数信息 误删
#业务基本参数
[INIT]
VERSION=01
SVCCODE=T1001
DATETYPE=2
LEVEL=9
USERNAME=20029000000668404
USERPASS=9A03258EE362B6D7
ORGID=99991114
USERMERID=200290000006684
SIGNEDTYPE=1001
MERCHANTID=200290000006684
TERMID=00000000
BUSINESSCODE=19300
TLORGID=99991133
#RSA签名密钥
[SIGN]
PrivateKey=xyk_private.pem
PublicKey=xyk_public.pem
#加密机地址
[LOCAL]
IP=188.200.164.17
PORT=6666
[BACK]
IP=188.200.164.18
PORT=6666
大家看看怎么读出等号后面的
[解决办法]
先使用strstr 提取每行->char* sLine
char* p=strstr(sLine,"=");
int l=strlen(p);
char* pdes=malloc(sizeof(char)*l+1);
strcopy(pdes,p);
[解决办法]
Sub StringLeftEqual()
Dim txt As String
txt = "c:\1.txt"
Dim strData As String
Dim nLoc As Integer
Open txt For Input As #1
Do While Not EOF(1)
Line Input #1, strData
nLoc = InStr(1, strData, "=")
If (nLoc <> 0) Then
Debug.Print strData
Debug.Print Right(strData, Len(strData) - nLoc)
End If
Loop
Close #1
End Sub
FILE * pFile;
char mystring [100];
pFile = fopen ("c:\\1.txt" , "r");
if (pFile == NULL)
return;
while( fgets (mystring , 100 , pFile)!= NULL )
{
char* p = strchr(mystring,'=');
if ( strchr(mystring,'=') != NULL)
{
printf("%s",(p+1));
}
}
fclose (pFile);