首先,我会说我实际上可以编译C语言,至少它对于一个简单的"hello world“是有效的。但是,我无法编译以下.c代码:
#include <stdio.h>
#include <stdlib.h>
#define STRINGSIZE 10
int getLastPosition(char word[])
{
int cont=0;
while(cont<STRINGSIZE)
{
if(word[cont]=='\0')
{
break;
}
cont++;
}
return cont;
}
void cipher(int key, char *firstChar, char *lastChar)
{
char *currentChar = NULL;
currentChar = firstChar;
while(currentChar<lastChar)
{
*currentChar += key;
currentChar++;
}
printf("\nThe ciphered word is: ");
currentChar = firstChar;
while(currentChar<lastChar)
{
printf("%c", *currentChar);
currentChar++;
}
}
int main()
{
char word[STRINGSIZE];
char *firstChar = NULL;
char *lastChar = NULL;
int key;
printf("Enter a word to cipher (max 10 chars)> \n");
scanf("%s",word);
printf("Choose a number to cipher the word > \n");
scanf("%d",&key);
firstChar = &word[0];
lastChar = firstChar + getLastPosition(word);
cipher(key, firstChar, lastChar);
}
我没有阻止输出文件的杀毒软件。但是,我从任务管理器中看到cipher.exe确实是作为一个进程加载的,但是终止任务并重新运行c代码对我来说是行不通的。有人能帮上忙吗?
发布于 2020-11-19 21:39:31
你真的应该发布构建过程的输出。
但从您所说的情况来看,您似乎无法覆盖输出文件。基本上,你需要确保你可以覆盖它:
\\\\
开头)的位置构建时,可能会出现问题。因此要避免在路径中使用特殊位置和特殊字符。https://stackoverflow.com/questions/64893469
复制相似问题