下面的程序的目的是:通过用户输入"windows"进入c:\windows目录,也就是程序的本来设计输出是:The current directory is:c:\windows
但是现在只能进入c:\
请问怎样修改,thanks
include <stdio.h>
#include <direct.h>
#include <dir.h>
#include <string.h>
#include <stdlib.h>
#include <io.h>
int main(void)
{ char buffer[255];
char singer[256];
_chdrive(3);
chdir("\\");
gets(singer);
printf("输入");
chdir("singer");
getcwd(buffer, 55);
printf("The current directory is: %s\n", buffer);}
但是现在只能进入c:\
请问怎样修改,thanks
include <stdio.h>
#include <direct.h>
#include <dir.h>
#include <string.h>
#include <stdlib.h>
#include <io.h>
int main(void)
{ char buffer[255];
char singer[256];
_chdrive(3);
chdir("\\");
gets(singer);
printf("输入");
chdir("singer");
getcwd(buffer, 55);
printf("The current directory is: %s\n", buffer);}
解决方案 »
- glLoadIdentity的问题
- 关于dll输入输出函数的菜问题
- 关于绘制窗口的问题
- CTreeCtrl使用的一个问题
- 如何让指定窗口置前?
- 怎样导出一个类?请哪位大侠指教,无限感激,并当场给分20,答先得,后答不得分。
- 求助大虾,在vc++里面怎样调用磁盘啐片整理程序!系统是win2000,最好能用API函数!!!!在线等待!!!!急用!!!!!
- 我想把我编的程序放到网站上去,请问哪儿有关于CGI的书可以下载
- vs2010 MFC 单文档中怎么实现数字表头效果啊如图:
- 如何使用 AfxEndThread ??
- 在socket编程中,怎样才能有服务器端知道有客户连接上来了?
- 有没有用过COM+事务的高手了?进来看看行不行?(在线等)
//把要列表的目录设置为当前目录
_chdir((LPCTSTR)Dir_Name); // Change the current working directory.
它提示:undeclare: cstring和LPCTSTR
请详细点说明,我很差的。
#include <direct.h>
#include <dir.h>
#include <string.h>
#include <stdlib.h>
#include <io.h>
int main(void)
{ char buffer[255];
char singer[256];
gets(singer);
printf("输入");
sprintf(buffer,"c:\\%s",singer);
chdir(buffer);
getcwd(buffer, 55);
printf("The current directory is: %s\n", buffer);}