相关疑难解决方法(0)

Xcode:简单语言的目标和方案是什么?

是的标题说:-)他们用简单的英语语言是什么意思?我真的不明白Apple网站上的解释,我需要重命名我的目标,我担心之后没有任何作用..

xcode ios

191
推荐指数
5
解决办法
5万
查看次数

代码在g ++中运行完美但在Xcode中运行不正确 - 无法找到文件

我创建了一个包含内容的文本文件.它与cpp文件位于同一文件夹中.我已多次确认该文件存在.当我运行g ++时,编译并运行它会找到该文件.当我在Xcode中运行它时,它不起作用.如果找不到该文件.

#include <iostream>
#include <fstream>
#include <string>
using namespace std;

int main () {
  string line;
  ifstream myfile ("example.txt");
  if (myfile.is_open())
  {
    while ( myfile.good() )
    {
      getline (myfile,line);
      cout << line << endl;
    }
    myfile.close();
  }

  else cout << "Unable to open file"; 

  return 0;
}
Run Code Online (Sandbox Code Playgroud)

c++ xcode g++

5
推荐指数
1
解决办法
2974
查看次数

我的C程序读取文本文件.当我把它放入Xcode时它失败了.发生了什么?

我有一个打开.txt的函数,使用fscanf读取格式如下的数字:

532
2
-234
32
Run Code Online (Sandbox Code Playgroud)

当我使用GCC编译时,它成功地执行了此操作,但是我无法在Xcode中打开文件,为什么?相关代码是:

int main (void){
    FILE *infile = NULL;  //input file buffer
    int int_array[100];   //an integer array 100 entries long
    char infilename[256];  //an extra large char array 
        //this entire while loop was provided as part of the assignment, 
        //we weren't supposed to change it. I've finished this assignment, 
        //but now I want to know how to use my Xcode debugger
    while(infile == NULL) {
        printf("Input filename:");     //user prompt
        scanf("%s",infilename);        //store user input in large char array …
Run Code Online (Sandbox Code Playgroud)

c xcode fopen

2
推荐指数
1
解决办法
2万
查看次数

标签 统计

xcode ×3

c ×1

c++ ×1

fopen ×1

g++ ×1

ios ×1