|
garfaoui wrote: ...but i have to compare more than one file with the model file.
So why not just a variable in the call to fichier10.open() rather than a string literal? You could put all of your comparison code in a function, and call that function any number of times using a different filename each time. Make sense?
garfaoui wrote: for (i=1;i<=55;i=i+1) {
vadves>>c;
fichier10>>c;
}
I'm assuming this is for skipping the first 55 bytes of both files. Correct? If so, I believe there is a seekg() function that would be much more elegant.
garfaoui wrote: rename("ICET0R.WZT.MXS.G0900V00.G2307215", ostr.str().c_str());
What is the second argument to rename() ?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
I didn´t call fichier10.open() simply because i don´t know this function. I am a real beginner!
Concerning the skipping of the 55 first bytes your right. And if i didn´t use the function seekg() it´s again because i didn´t know it exists, so i had to do without it. However, i am not trying to be elegant for now, i am just trying to have programm which works . But next time i have to do that kind of task be sure that i will use seekg()
And finally, the second argument is to put the date at the end of the name of file. It´s related with:
<br />
time_t date_codee;<br />
tm * date;<br />
ostringstream ostr(ostringstream::out);<br />
date_codee = time(NULL);<br />
date = localtime(&date_codee);<br />
ostr << "clippr-" <br />
<< date->tm_mday <br />
<<"-"<br />
<< date->tm_mon + 1 <br />
<<"-"<br />
<< date->tm_year + 1900<br />
<< ".txt";
So now, i have a running programme, but i still have a problem with the name of files which changes every day. I have tryied to get information about CFileFind::FindFile and CFindFile::FindNextFile , but i don´t understand...
Could anyone show me an exemple with wide comments?
Thank you
|
|
|
|
|
garfaoui wrote: I didn´t call fichier10.open()...
Sure you did. Check your original post.
garfaoui wrote: I have tryied to get information about CFileFind::FindFile and CFindFile::FindNextFile, but i don´t understand...
Nor should you, as that just adds unnecessary overhead. Forget MFC was even mentioned. Perhaps you need to look into _findfirst() and _findnext() instead.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
oh yes! i have used it!
ok thank you i will try those command!
Thank you very much!
|
|
|
|
|
Greetings people,
im currently having grief trying to convert a string from type CString to char. here is a sample of the code that im running:
char UserName[25] = '';
wcstombs(UserName, g_xSettings.m_sEmployeeName, g_xSettings.m_sEmployeeName.GetLength()+1);
the problem that im having is that when all is said and done, UserName only hold the first character. For example if g_xSettings.m_sEmployeeName holds "Paul Kiragu" UserName will only have the first character ie "P"
Additional info: im using Microsoft eMbedded C++ 4.0
What am i doing wrong? is there a better way of doing this?
Best regards,
Pete.
|
|
|
|
|
That would be
wcstombs(UserName, g_xSettings.m_sEmployeeName, sizeof( UserName)/sizeof(UserName[0]);
as you need to give the size of your Buffer.
(Ok, the count calculation could technically be omitted, but I include It for completness)
Also, you could add a wcstombs -call with a NULL first parameter, and allocate your string according to the wcstombs return value, which is the size needed.
For your Problem, are you sure about the length? what did strlen( UserName) say?
I could imagine that there is a conversion problem in the debugger visualizing the text in the variable.
But I must admit that I have never used MS Embedded C++.
Failure is not an option - it's built right in.
|
|
|
|
|
Hey dude, thanks a lot! it now works like i want it to.
Only modification that i needed to make was to add 1 to the size of UserName so that it can also take care of the carriage return. and to think that this problem has been eating me alive for two entire days!!!
Once again thanks a million, much appreciated.
Pete.
|
|
|
|
|
in Windows, Control Panel > Regional and Language Options > Advanced > Language for non-Unicode programs
It says that 'It does not affect Unicode programs'
But as to my program, if I choose English as the 'Language for non-Unicode programs', everything is fine. my program can show Chinese or Korean both in menus and dialogs. but if I choose Chinese as the 'Language for non-Unicode programs', My program can't display Korean, if I choose Korean, my program can't display Chinese.
So it seems that my program is affected by this setting.
Maybe my program is not a unicode program? I used UNICODE _UNICODE, and I set wWinMainCRTStartup as the entry point. everything seems working.
So where shall I check? I don't want my program to be affected by this Windows setting.
|
|
|
|
|
If you're using Windows CE up to 5.0 then you've simply run up against the 'can't use more than one east asian language' (Chinese, Japanese, Korean) limitation which is built into CE.
It sounds more like XP in which case your problem would likely be with the default code page as I think that's what's being set in the dialog you mention. Somewhere in your code the default code page is being referenced in a conversion from UNICODE to ANSI characters and setting it to non English is messing up one set of characters or the other. I suspect that when the default code page is English Windows can detect Chinese and Korean characters because they're all 'invalid' in the old ASCII range but when it's Chinese the Korean character values look valid. (Beause of CJK shared characters some of them probably are ). To be safe accross Windows systems that default to all 3 languages you'll need to find the conversion that's failing and preferably avoid it altogether. Remember to separate what you see (glyphs from a font) from the code points that are being represented. I find it helps to try and think in code points but that's really difficult if you're looking at your native language. I18n is hard, good luck.
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
Hi.
I am trying to create a folder programatically in the all programs of start menu with a dot(.) at the end. But it is ignoring the (.) at the end, and creating the folder without the (.) at the end.
I also observed that the windows itself not allowing to create the folder with (.) at the end.
Pls. help me.
Kishore
|
|
|
|
|
I don't think you can do this, Windows will assumes you have missed off the extension and will simply remove the '.'
Why do yo want to do this ?
|
|
|
|
|
I have a project. The name of the package includes the '.' at the end. For example "A.B.C." . But it is creating the folder "A.B.C" in the all programs of Start menu. The client wants the dot (.) at the end also.
Kishore
|
|
|
|
|
The client may very will want it, but you can't do it unless you have some 'special' non-visible character added to the end of the name.
I don't think you'll be able to do this, also why does the client care if the (.) is there or not ?
Who is going to notice ?
regards,
|
|
|
|
|
The dot is a special character as far as the file system is concerned. It cannot be used in the fashion you desire.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
i want to convert WTL coding in to MFC..
is there any way?
please tell...
thanks in advance..
rokini.k
|
|
|
|
|
Rokini wrote: is there any way?
No.
Kevin
|
|
|
|
|
you can basically generate the outer framework like views, dialogs etc using mfc wizard and then incrementally transplant the code.
if you know WTL I think you this process should be easily and pretty straight forward and you should be able to understand the MFC stuff!!! ... I don't think there is any such tool to do this for you!
btw, welcome to MFC you made the smart choice ... ok this is an inside joke someone else who loves WTL and hate MFC...I am sure he will find his way to this page and be horrified!!!
Yours Truly, The One and Only!
|
|
|
|
|
Is the VC++ application multitasking?
If some message comes from outside to application while any function is running, what will happen?
The message processed first or it processed after completion of current function?
Best Regards,
Suman
|
|
|
|
|
A newly created application is single threaded. It means that if you call a lenghty function, no windows messages will be processed (which means that your GUI will not respond until the function finishes). You need to start a new thread yourself to handle that situation.
|
|
|
|
|
Hi
I need some trick/code to perform this operation (Copy all files from a folder to another folder, recursively) in C++.
Best Regards,
Mushq
Mushtaque Ahmed Nizamani
Software Engineer
Ultimus Pakistan
"English is my second language; please excuse any grammatical or spelling mistakes"
|
|
|
|
|
SHFILEOPSTRUCT s = { 0 };
s.hwnd = m_hWnd;
s.wFunc = FO_COPY;
s.pTo = "C:\\destinationn\0";
s.pFrom = "C:\\source\\*\0";
s.fFlags = FOF_SILENT;
SHFileOperation( &s );
The key to this api is that the source and destination strings need to be double null terminated.
|
|
|
|
|
hi i have to download file from an url using mfc program. my codeing is downloading fine. but when there is no file in that url, it hangs(url is valid only). how to know if the file exist or not? pls help me.
Arise Awake Stop Not Till ur Goal is Reached.
|
|
|
|
|
What function are you using to do the downloading?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
For download you can use of URLDownloadToFile function did you use of it?
|
|
|
|
|
Hi,
I have capture the handle of running application.How can i minimise the application through application handle.
I used EnumProcesses(),EnumProcessModules() function.
|
|
|
|