Strange Problem calling chdir()

Peter Mueller peter.o.mueller at gmx.de
Mon Dec 30 14:16:08 UTC 2002


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello all,

I have a strange problem with the code shown below. In dummyHMI::test()
argc/argv are in reality built from commands/parameters I get from a
serial line. The problem is that the name holds "test" as expected in
dummyClient::printdir(), but is empty in chdir().

The code works fine under native Linux. I'm working with 
rtems-ss-20020628 and  m68k-rtems-gcc 2.95.3

Any ideas?

Thanks a lot,
Peter



- -- 


class dummyClient{
public:
	void printdir(int argc, char* name){	// name zeigt noch den richtigen wert
("test")
	
		int res = chdir(name);	// in chdir ist name = ""
	
	}
};

class dummyHMI{
public:

	dummyHMI::dummyHMI(dummyClient* in){
		m_client = in;
	}
	
	void dir(int argc, char* argv[]){
		
		if(argc>1)
			m_client->printdir(argc, argv[1]);
	}

	void test(void){
		char buffer[]="a.out\0test\0";

		char* myargv[10];
		int myargc=2;

		myargv[0]=buffer;
		myargv[1]=&buffer[6];

		dir(myargc, myargv);
	}
	
	dummyClient* m_client;	
		
};


Init(){

	dummyClient * aclient = new dummyClient;
	dummyHMI* hmi = new dummyHMI(aclient);

	hmi->test();
}
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)

iD8DBQE+EFUoUzCcwYQMTJoRAoUsAJ9YwFqm7hRWQnqTlLjibVvmSeu8ZQCfYp6S
v1ZZo498Omx9aPiaQ1i5fdA=
=HwSv
-----END PGP SIGNATURE-----



More information about the users mailing list