Hello, so i wrote a program for a class that takes in a text file containing numbers and then outputs it as a picture with each number having a specific color.  I created two versions, a 16bit and a 32 bit.  The issue i am having is that with the 32bit it is looking for the file in the wrong directory. The 2 programs and text files are located in C:\User\Documents\assembly\assignments\assignment3, but the 32bit program will only work when i have the text file in C:\User\Documents\assembly\Project_sample.  I am using visual studio 2010 and have been programming using the irvine libraries.  If anyone has any ideas to why this is happening, i would be very appreciative, thanks
Posted on 2011-11-24 10:50:19 by camitzel
have you tried executing the program directly (ie not through VS)?

By default, to open a file with just the name, ie without using a path it will look in the executing programs root folder only. Debug the program and see what its doing!

I have never used Irvine libs but using the standard win32 api's I would tend to use something along the lines of:
GetCurrentDirectory
lstrcat the filename onto the path returned
then use that to open the file using:
CreateFile, , GENERIC_READ OR GENERIC_WRITE etc

or else look at Common Dialogs
Posted on 2011-11-25 04:10:21 by MACH4
How are you including the files? Via project settings in MSVC? Or actually a code problem?
Posted on 2011-11-25 06:06:08 by Homer
Yes , look at the Working Directory setting, because when you build and execute, it will #1, execute from the build folder, and #2, set working directory (if present) to the project setting, hint is to copy the exe from the (Debug?) folder, into the working directory and execute it there, or set the output and working directories correctly and be lazy like a fox!
Posted on 2011-11-25 06:08:00 by Homer
msvc has a few problems, recently i had a problem with a cpp file just refusing to take part in the build, the changes i made had no effect, breakpoints were not reached etc - turned out i had a file of the same name, in a folder that was included before the one containing mine, and msvc decided it had already parsed that file... even though I was including it by its full qualified path(!) And I found a proven, repeatable bug on msvc 64 bits for win7, when building 32 bit code, pointers can be 4,8,12 or 16 bytes!!(!) Basically this means, you can NOT build working 32 bit code requiring (most kinds of) pointers on 64 bit compiler. Maybe they think we will jump on our old machine for that.
For proof, create a 32 bit project from template, and in code, compare sizeof(void*) and sizeof(SomeClassName*) :) Make SURE you are set up for a 32 bit output exe and run it!
Posted on 2011-11-25 06:10:29 by Homer