• Advertisement
Sign in to follow this  

Where is this file generated?

This topic is 1660 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

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

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