|
Hello,
This[^] very nice class should fit all your needs..
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
|
there is not open mode in fstream(ios) for creating a new file if the given file doesnt exist. how could I do that?
thanks
|
|
|
|
|
Doesn't that happen by default? Check out the fstream constructor's documentation.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
I dont think so, since I have tried , it donesnt work. and little information on fstream in msdn.
you have any idea?
thanks
|
|
|
|
|
heng0987 wrote:
I dont think so, since I have tried , it donesnt work.
What does your code look like? This works fine for me:
fstream ff("c:\\david.txt", ios::out);
ff << 123;
ff.close(); heng0987 wrote:
...and little information on fstream in msdn.
Really?[^]
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
could you plz tell me in complete details how can i call matlab functions from a c++ program .
NOTE: ( i've already tried using engine.h but i got an error telling me" unresolved external symbol _engopen")
gobar
|
|
|
|
|
Did you include the lib that contains engopen?
Check this directory for some of the libraries that you need to link.
<matlab path="">\extern\lib\win32\microsoft\msvc60
|
|
|
|
|
i have created an SDI MFC app. How do i get it to check its own location on the hard-drive and spit back the path? IS there a path property for the executable?
thanks
|
|
|
|
|
GetModuleFileName(NULL, ...)
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
TCHAR buff[MAX_PATH];
GetModuleFileName(NULL, buff, MAX_PATH);
char drive[3];
char dir[MAX_PATH];
char fname[MAX_PATH];
char ext[MAX_PATH];
_splitpath(buff, drive, dir, fname, ext);
|
|
|
|
|
You may find this code intresting
CString strTmp,strDirectory;
GetModuleHandle(NULL,strTmp.GetBuffer(MAX_PATH),MAX_PATH);
strTmp.ReleaseBuffer();
strDirectory=strTmp.Left(strTmp.ReverseFind('\\'));
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
Does anyone know what needs done to get the project built in Release mode.
Debug build is OK.
SSIC_Example error LNK2005: "class _AFX_THREAD_STATE * __stdcall AfxGetThreadState(void)" (?AfxGetThreadState@@YGPAV_AFX_THREAD_STATE@@XZ) already defined in mfc71.lib(MFC71.DLL)
SSIC_Example error LNK2005: "class AFX_MODULE_STATE * __stdcall AfxGetModuleState(void)" (?AfxGetModuleState@@YGPAVAFX_MODULE_STATE@@XZ) already defined in mfc71.lib(MFC71.DLL)
SSIC_Example error LNK2005: "class CWinThread * __stdcall AfxBeginThread(unsigned int (__cdecl*)(void *),void *,int,unsigned int,unsigned long,struct _SECURITY_ATTRIBUTES *)" (?AfxBeginThread@@YGPAVCWinThread@@P6AIPAX@Z0HIKPAU_SECURITY_ATTRIBUTES@@@Z) already defined in mfc71.lib(MFC71.DLL)
SSIC_Example error LNK2005: "class CWinThread * __stdcall AfxGetThread(void)" (?AfxGetThread@@YGPAVCWinThread@@XZ) already defined in mfc71.lib(MFC71.DLL)
SSIC_Example error LNK2005: "int __stdcall AfxMessageBox(char const *,unsigned int,unsigned int)" (?AfxMessageBox@@YGHPBDII@Z) already defined in mfc71.lib(MFC71.DLL)
SSIC_Example error LNK2005: "protected: class CFrameWnd * __thiscall CCmdTarget::GetRoutingFrame(void)" (?GetRoutingFrame@CCmdTarget@@IAEPAVCFrameWnd@@XZ) already defined in mfc71.lib(MFC71.DLL)
i.e. what setting have I forgot to change in Release mode.
|
|
|
|
|
Somehow it seems to be trying to link both the MFC DLL and the static MFC library. If you changed the setting 'Use of MFC' in Project Properties for the Debug build, change the Release build to match. Otherwise, it could be that some other static library you're trying to link with was linked with the static MFC library.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
Thanks for your post. I did ensure that all project link to MFC in shared DLL, but now get the following errors:
Example error LNK2005: ___xc_a already defined in msvcrt.lib(cinitexe.obj)
Example error LNK2005: ___xc_z already defined in msvcrt.lib(cinitexe.obj)
Example error LNK2005: ___xi_a already defined in msvcrt.lib(cinitexe.obj)
Example error LNK2005: ___xi_z already defined in msvcrt.lib(cinitexe.obj)
Example error LNK2005: __amsg_exit already defined in msvcrt.lib(MSVCR71.dll)
Have you any futher suggestions for the above?
|
|
|
|
|
It's pretty much the same problem, only this time the library at issue is the C/C++ run-time. The setting you're looking for is C/C++ > Code Generation > Runtime Library.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
Is there a simple way of making the Exe for my program get a different icon depending on whether it's a debug or release build?
I can change the icon the main dialog uses at run time without problem, but not the icon that the exe has in explorer
--
Help me! I'm turning into a grapefruit!
Buzzwords!
|
|
|
|
|
F*****G CodeProject
I enter a message and hit Suhbmit, and the progress bar in Explorer goes to 100% and then just sits there!
Okay, as I type this in for the THIRD time...
Why not?
You can just add two different icons to your program based upon conditional compilation of the RC file.
Put a different one in there for release and debug.
I am pretty sure Explorer just uses the icon with the lowest numerical index.
Hope this one makes it into the forum...
|
|
|
|
|
Hmm, from experience I've found that compiler directives really don't work too well inside RC files
But I'll give it a try and see what happens
--
Help me! I'm turning into a grapefruit!
Buzzwords!
|
|
|
|
|
If you are using Visual Studio 6.0, it has an explicit tab for setting resource compiler settings.
See Project Settings Dialog : Resources Tab : PREPROCESSOR DEFINITIONS Edit Field
So, one of my projects, for exmaple, already has _DEBUG defined for the debug build.
Inside your RC or .RC2 file, do something like this
#ifdef _DEBUG<br />
1 ICON "MyDebug.Ico"<br />
#else<br />
1 ICON "MyRelease.Ico"<br />
#endif
and see if that works for you.
I would probably put it into the RC2 file, since the resource editor usually yacks on 'unexpected' preprocessor statements.
|
|
|
|
|
i want to create an array whose size is dynamic. Each node of the array should be an array of characters of length 20.And then i want to send this as an argument in a function.
This is what i have done.....
<br />
char *m_strTemp[10] = new char[count];<br />
After getting the value of "count" i start filling the array.
Now to send it as an argument of a function i declared the function as follows.
void CIdentifyDlg::SetVariable(char *str[10])<br />
{<br />
char *tempStr[10] = new char[count];<br />
tempStr = str;<br />
}<br />
The function is called as follows
<br />
SetVariable(m_strTemp[10]);<br />
This is giving error.
Can anyone please help me out. Hope my question is clear....
|
|
|
|
|
nripun wrote:
This is giving error.
I give up. What's the error?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
nripun wrote:
char *m_strTemp[10] = new char[count];
here you allocate an array of 10 char pointers and assign the char pointer returned by new to element zero (m_strTemp[0]). It's not an array of 10 (valid) pointers to char arrays.
nripun wrote:
char *tempStr[10] = new char[count];
tempStr = str;
same issue as above. Furthermore, in the second line you set the pointer tempStr to point to the same location as str points to (which is an array of 10 char pointers, where the first one points to a valid array). You do not copy the data pointed to by str into the array pointed to by tempStr.
nripun wrote:
This is giving error.
which error?
I would use containers instead, either MFC containers or STL ones.
Cheers
Steen.
"To claim that computer games influence children is ridiculous. If Pacman had influenced children born in the 80'ies we would see a lot of youngsters running around in dark rooms eating pills while listening to monotonous music"
|
|
|
|
|
Why don't you use std::string (from the Standard Template Library) or CString (from MFC) instead ?
It will look like this:
void CIdentifyDlg::SetVariable(std::string* StringsArray, int nCount)<br />
{<br />
for (int i=0;i<nCount;i++)<br />
{<br />
std::string TempString = StringsArray[i];<br />
}<br />
}<br />
|
|
|
|
|
can you please tell me how to store numbers in a CString object??
|
|
|
|