繁体   English   中英

在终端中执行用户输入文件时拒绝 VS 代码访问

[英]VS code access denied when executing user input file in terminal

到目前为止,这是我尝试过的,但是在运行程序后,这显示了一些错误;

#include <stdio.h>
#include <stdlib.h>

int main(){



    int number; 
  
    printf("Enter the number:");
    scanf("%d",&number)
    printf("The number is %d",number);
    return 0;
}

但是当我运行程序时,它显示了这个错误

Program 'hello.exe' failed to run: Access is deniedAt line:1 char:59
+ cd "d:\c\" ; if ($?) { gcc hello.c -o hello } ; if ($?) { .\hello }
+                                                           ~~~~~~~.
At line:1 char:59
+ cd "d:\c\" ; if ($?) { gcc hello.c -o hello } ; if ($?) { .\hello }
+                                                           ~~~~~~~
    + CategoryInfo          : ResourceUnavailable: (:) [], ApplicationFailedException
    + FullyQualifiedErrorId : NativeCommandFailed

我也有同样的问题。 有几件事可能会导致此错误。

  1. MinGW 未正确安装。 如果未安装,请正确安装。 点击这里

  2. 如果您的代码不涉及从用户那里获取任何输入并正确提供 output,并且当代码需要用户输入时显示“拒绝访问”,则可能是由于您使用的防病毒软件所致。 我有同样的问题,我发现我的防病毒软件“McAfee”导致了这个问题,我卸载了它。 代码运行良好。 但是 Windows Defender 不会导致这个问题,因此我现在使用 Windows Defender 来保护我的电脑。 如果您不信任 Windows Defender 并且您确实认为您现在使用的防病毒软件是必要的,请不要为此使用 go。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM