Tcl_EvalFile for chinese path in Win2000, occur failed
Closed / Invalid867509ffffffffffffffffffffffffffffffffffCreated 23 years agoUpdated 22 years ago
Descriptionplain2003-12-30 07:02:15
Tcl_EvalFile for chinese path in Win2000, occur failed:
void CTclExecDlg::OnButtonRun()
{
UpdateData(TRUE);
Tcl_FindExecutable(AfxGetApp()-
>m_pszExeName);
Tcl_Interp* pInterp = Tcl_CreateInterp();
if(pInterp == NULL)
{
TRACE(_T("Interp create failed.
"));
return;
}
Tcl_Preserve((ClientData)pInterp);
char scriptFile[1024];
strcpy(scriptFile, m_sScriptPath);
Tcl_DString tStr1;
Tcl_ExternalToUtfDString(NULL, scriptFile, -1,
&tStr1);
int result = Tcl_EvalFile(pInterp,
Tcl_DStringValue(&tStr1));
if (TCL_OK != result )
{
TRACE(_T("Execute failed.
"));
}
Tcl_DStringFree(&tStr1);
if(Tcl_InterpDeleted(pInterp) == 0)
Tcl_DeleteInterp(pInterp);
Tcl_Release((ClientData)pInterp);
}
dgpplain2003-12-31 23:08:11
Logged In: YES user_id=80530 what is the value of m_sScriptPath? and what encoding is it in? and what is the system encoding?
rongbing11968plain2004-01-08 16:18:40
Logged In: YES user_id=940212 m_sScriptPath is "D:\Softphone2.2\project\ICD3.0平台 \rule\rb2004\my.tcl". encoding is CP936. System encoding is CP936.
msoferplain2004-01-09 06:04:22
Logged In: YES user_id=148712 Don: you spoke up, it's all yours - I wouldn't know where to start
rongbing11968plain2004-01-10 09:08:50
Logged In: YES user_id=940212 The attached file is my test program. When we click RUN button, Tcl_EvalFile will return "counldn't read file D:\Softphone2.2\PROJECT\ICD3.0平台\Rules\my.tcl: no such file or directory". My OS is WinXP chinese version.
dgpplain2004-01-14 07:02:57
Logged In: YES user_id=80530 there is no file attached.
davygrvyplain2004-01-15 16:23:47
Logged In: YES user_id=7549 D:\Softphone2.2\PROJECT\ICD3.0平台\Rules\my.tcl Is the filename displayed in the error message the correct filename as you expect to see it?
bladesunplain2004-06-28 09:18:28
Logged In: YES
user_id=1072261
I have encountered the similar problem!
my OS: win2000 SP4 Chinese
my Tcl Realese: ActiveTcl8.4.6.1-win32-ix86-99631
following is my very simple program:
void main(int argc, char *argv[]){
char *str = "D:/MyCode/Going/test.tcl";
Tcl_Interp* interp=Tcl_CreateInterp();
Tcl_Init(interp);
if(TCL_OK!=Tcl_EvalFile(interp, str)){
Tcl_DeleteInterp(interp);
return;
}
Tcl_DeleteInterp(interp);
exit(0);
}
successed compling under VC6.0!
when executing, segment erroe occur, the OS message just
like this(translated from chinese):
Instruction "0x00000000" references "0x00000000" address
which cann't be read
when debugging in VC, the message is:
Unhandled exception in myprom.exe:0xC0000005: Access
Violation.
nobodyplain2004-06-28 14:31:22
Logged In: NO PS: I tested the same program under tcl8.3.5(complied using tcl8.3.5-src.tar.gz from here), there is no problem!
bladesunplain2004-06-28 14:36:50
Logged In: YES user_id=1072261 PS: I tested the same program under tcl8.3.5(complied using tcl8.3.5-src.tar.gz from here), there is no problem!
dgpplain2004-06-28 19:28:13
Logged In: YES user_id=80530 bladesun, your example program is missing a call to Tcl_FindExecutable(). Add Tcl_FindExecutable(argv[0]) before the Tcl_CreateInterp() call, and see if that corrects your trouble.
bladesunplain2004-06-29 08:52:06
Logged In: YES user_id=1072261 dgp, you are right! It seems to be my fault ... but why not keep upward compatible?
dgpplain2004-06-29 21:06:43
Logged In: YES user_id=80530 Tcl_FindExecutable() calls have been required since Tcl 8.1. It's a mystery to me why your program worked with 8.3.
hobbsplain2004-06-30 01:11:59
Logged In: YES user_id=72656 The Tcl_FindExecutable was correct for 8.1+ and documented as such. It became essential with 8.4 changes, whereas before you could get away without it - but it was still supposed to be there.
Log in (anonymous is fine) to add a comment.