Thread View: sun.tech
1 messages
1 total messages
Started by Jason Freund
Mon, 27 Aug 1990 23:23
Sun Pascal: Pascal calls C
Author: Jason Freund
Date: Mon, 27 Aug 1990 23:23
Date: Mon, 27 Aug 1990 23:23
44 lines
1877 bytes
1877 bytes
I am calling a C routines from a Pascal program to (among other things)
change directories. I am using several other C routines to do other system
calls and only the ones that get arguments (such as cstr) passed to them fail.
What is wrong with:
------------------------system_cd.c-------------------
#include <stdio.h>
system_cd (cstr)
char *cstr;
{
char cmnd[50];
sprintf(cmnd,"cd %s",cstr);
printf(cmnd);
system(cmnd);
}
---------------------------------------------------------
it's declared in the pascal part like:
procedure system_cd (cstr: string); external c;
and called like: {s is a string}
system_cd(substr(s, 4, length(trim(s))));
Simple calls like "system_pwd() { system("pwd") }" work perfectly.
follow up to : jasonf@cetemp.Corp.sun.com
Thanks,
Jason Freund, Sun Microsystems, jasonf@cetemp.Corp.sun.com <== summer address
Deprtmnt of Computer Science, Univ California, Davis. freund@sakura.ucdavis.edu
Quantum Link: JasonF5, Compu$erve: 72007,244, 690 Erie Dr, Sunnyvale, CA 94087
-------------------------------------------------------------------------------
STOLEN QUOTES -- Please give the authors credit if you know who they are!
"To understand recursion, you need to understand recursion."
"Wow! Virtual memory! Now I'm gonna build me a REALLY big ram disk!"
"My other computer is a SUN3/50." "E. Pluribus UNIX" -- authors unkown
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads