首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ >

关于system 用法解决方法

2012-04-17 
关于system 用法#include stdio.h#include stdlib.h#include iostreamint main(){char fileName[]

关于system 用法
#include <stdio.h>
#include <stdlib.h>
#include <iostream>

int main()
{
  char fileName[] = "C:\\Documents and Settings\\x_wangx\\Desktop\\6631757\\StudentManagement.exe";
  int error = 0;
   
  error = system( fileName );
   
  return 0;
}
system 错误返回值1
请教哪里错了

[解决办法]
路径里有空格吧,试着用\"括起来
[解决办法]

C/C++ code
char fileName[] = "\"C:\\Documents and Settings\\x_wangx\\Desktop\\6631757\\StudentManagement.exe\"";
[解决办法]
Documents and Settings 有空格,你要考虑它得放在引号里面
[解决办法]
路径有空格、会当成多个参数、用 \" filepath \"

热点排行