Jump to content
  • Advertisement
Sign in to follow this  
Timptation

Where is this file generated?

This topic is 1902 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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;

}

Share this post


Link to post
Share on other sites
Advertisement

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?

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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!

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!