當前位置: 首頁 > 工業(yè)電氣產(chǎn)品 > 工業(yè)開關 > DIP開關
發(fā)布日期:2022-04-26 點擊率:315
<script
var cpro_id = "u1457042"; <iframe id="iframeu1457042_0" qctm?rdid=1457042&dc=2&di=u1457042&dri=0&dis=0&dai=3&ps=425x362&dcb=BAIDU_SSP_define&dtm=BAIDU_DUP_SETJSONADSLOT&dvi=0.0&dci=-1&dpt=none&tsr=0&tpr=1459707669697&ti=%E6%80%8E%E4%B9%88%E8%AE%BE%E7%BD%AE%E5%AF%BC%E5%87%BA%E5%8F%98%E9%87%8F%E7%9A%84TXT%E6%96%87%E4%BB%B6%E8%B7%AF%E5%BE%84%E5%90%8D_%E7%94%B5%E6%B0%94%E8%87%AA%E5%8A%A8%E5%8C%96%E6%8A%80%E6%9C%AF%E7%BD%91&ari=1&dbv=0&drs=1&pcs=645x335&pss=970x426&cfv=0&cpl=22&chi=50&cce=true&cec=gbk&tlm=1402385675<u=http%3A%2F%2Fwww.dqjsw.com.cn%2Fdiangongdianzi%2Fdianlidiangong%2F79135.html&ecd=1&psr=1366x768&par=1366x728&pis=-1x-1&ccd=24&cja=false&cmi=34&col=zh-CN&cdo=-1&tcn=1459707670&qn=2911babf353785cf&tt=1459707669670.193.303.304" vspace="0" hspace="0" marginwidth="0" marginheight="0" scrolling="no" style="border:0; vertical-align:bottom;margin:0;" allowtransparency="true" align="center,center" width="200" height="200" frameborder="0"> |
問:我用C 腳本使內(nèi)部變量保存在一個名字為“name”的txt 文檔里,這樣重新啟動時也可以顯示其保存值,而不是初始值。
但是這個txt 文檔的路徑名不知道改怎么設定,其默認的文件路徑為:C:WINDOWSsystem32
請問該怎么設置路徑名?
我的程序如下:程序里并沒有設置路徑的語句。
#include "apdefap.h"
void onClick(char* lpszPictureName, char* lpszObjectName, char* lpszPropertyName)
{
#define MaxLineLength 80
FILE *fpFile;
char *strTag[5] = { "TagA", "TagB", "TagC", "TagD", "TagE" };
char *pTmp;
char buffer[MaxLineLength];
double dVal;
int i;
fpFile = fopen(GetTagChar("Filename"), "w+" ); //open file to write
printf ("C-script: write file: %s
", GetTagChar("Filename"));
if (fpFile !=NULL)
{
for (i=0; i<=4; i++){
dVal = GetTagDouble(strTag[i]);
sprintf(buffer, "%s;%lf
", strTag[i],dVal);
// Search for '.' and replace with ','
pTmp = strchr(buffer, (int)'.');
if (pTmp != NULL){
*pTmp = ',';
}
fputs(buffer,fpFile);
printf("%s
", buffer);
}
fclose(fpFile); //close file
} else {
printf ("Error: File not found!
");
}
}
答:fpFile = fopen(GetTagChar("Filename"), "w+" ); //open file to write
這條語句中可以看到路徑存放在變量名為Filename的字符串變量中,你在TAG Management中查找下該變量?;蛘咴贕lobal script中找找,也有可能是全局變量。
嫌麻煩的話直接改成:
fpFile = fopen("D:\Filename.txt"), "w+" ); //open file to write
下一篇: PLC、DCS、FCS三大控
上一篇: 索爾維全系列Solef?PV