Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Where is this file generated?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
7 replies to this topic

#1 fstim82   Members   -  Reputation: 132

Like
0Likes
Like

Posted 05 August 2013 - 09:06 PM

I have the following C++ code, and although I know from the output that the file exists and is being appended to, I can't find the actual file in my mac's Spotlight or with find in the terminal.  Can anyone help me find it?

 

 

int main(int argc, const char * argv[])

{

    FILE* pFile = fopen("Blah.txt", "a");

    

    if (pFile == NULL)

    {

        perror ("Error opening file");

    }

    else

    {

        int result = fputs("This is a test.\n", pFile);

        if(result == EOF)

        {

            cout << "Error using fputs.";

        }

        fclose(pFile);

        

        pFile = fopen("Blah.txt", "r");

        char buffer[1024];

        while( feof(pFile) == 0 )

        {

            fgets(buffer, 1024, pFile);

            cout << buffer;

        }

        

        fclose(pFile);

    }

    

    return 0;

}



Sponsor:

#2 Dragonsoulj   Crossbones+   -  Reputation: 2126

Like
0Likes
Like

Posted 05 August 2013 - 09:17 PM

File should be in the same directory that you are running the binary from.



#3 fstim82   Members   -  Reputation: 132

Like
0Likes
Like

Posted 05 August 2013 - 09:21 PM

I'm just running it from Xcode and I don't know where the binary is being made or where to check.  Actually, being a bit unfamiliar with mac, I'm not sure what extension I should be looking for either...  Not .exe right?



#4 Dragonsoulj   Crossbones+   -  Reputation: 2126

Like
3Likes
Like

Posted 05 August 2013 - 09:28 PM

You won't see a .exe. You might see a .bin (I'm not sure, don't quote me on this), or it might just be the name of the program you are making. Do you compile it through the command line or using an Xcode feature?

 

This might help: http://stackoverflow.com/questions/5952782/xcode-4-where-is-the-build-folder


Edited by Dragonsoulj, 05 August 2013 - 09:29 PM.


#5 fstim82   Members   -  Reputation: 132

Like
0Likes
Like

Posted 05 August 2013 - 09:32 PM

Its just the run button in Xcode.  Just like running from visual studio (which I'm more used to).  I can't seem to find a project settings menu that shows me the paths I'm used to seeing there, so I don't know where this file is and nothing seems to be able to search for it.



#6 Dragonsoulj   Crossbones+   -  Reputation: 2126

Like
0Likes
Like

Posted 05 August 2013 - 09:43 PM

Did you look at the link I gave?



#7 fstim82   Members   -  Reputation: 132

Like
0Likes
Like

Posted 05 August 2013 - 09:50 PM

Woah, I don't know how I missed that link.  Sorry about that.  Yep, that was exactly what I needed.   Thanks a bunch for the help!



#8 Dragonsoulj   Crossbones+   -  Reputation: 2126

Like
0Likes
Like

Posted 05 August 2013 - 09:51 PM

You probably were posting when I was editing that post. It's all good. Glad you found it.






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS