code: 9ferno

ref: 83246e296ea433b65b9d295b5e08fedd39ff1ab7
dir: /lib9/getwd-Nt.c/

View raw version
#include "lib9.h"
#include <windows.h>


char*
getwd(char *buf, int size)
{
	int n;
	char *p;

	buf[0] = 0;

	n = GetCurrentDirectory(size, buf);
	if(n == 0) {
		/*winerror();*/
		return 0;
	}

	for(p=buf; *p; p++)
		if(*p == '\\')
			*p = '/';

	return buf;
}