Click here to Skip to main content
15,893,594 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: mfc dll and resources Pin
Stephane Rodriguez.30-Sep-02 0:03
Stephane Rodriguez.30-Sep-02 0:03 
GeneralRe: mfc dll and resources Pin
Zizilamoroso30-Sep-02 1:25
Zizilamoroso30-Sep-02 1:25 
Generalmfc dll and resources - UPDATE Pin
Zizilamoroso30-Sep-02 1:30
Zizilamoroso30-Sep-02 1:30 
Questionwhich Db option? Pin
bryce29-Sep-02 22:10
bryce29-Sep-02 22:10 
QuestionHow can I remove popup menu in CHtmlView? Pin
sonshiro29-Sep-02 21:01
sonshiro29-Sep-02 21:01 
AnswerRe: How can I remove popup menu in CHtmlView? Pin
bryce29-Sep-02 22:33
bryce29-Sep-02 22:33 
Generalremoving separator in CComboBox Pin
yourbuddy7729-Sep-02 20:55
yourbuddy7729-Sep-02 20:55 
GeneralFormat strings and iostream Pin
Patje29-Sep-02 20:45
Patje29-Sep-02 20:45 
Hi all,

For years I've been using C format strings to create output strings that are written in message boxes, in files, ... You know, constructions like this:
printf ("Error found on line %ld in file %s", LineNumber, FileName);
This constructions makes it easy to add translations to your application:
printf (Translate("Error found on line %ld in file %s"), LineNumber, FileName);
The Translate function can then translate this english string to a french string.

There are some problems with this construction. First, the order of arguments in the format string must remain the same throughout all languages. Second, errors in the translations can crash your application.
Using C++ iostreams makes things much better, but I have to write things like this:
cout<<"Error found on line "<<LineNumber<<" in file "<<FileName;
Now try to add translate functionality to this, without translating silly strings like " in file ".

I once saw a construction where they used :1, :2, ... to replace the format specifiers, but I can't remember where I saw it. Format strings looked something like:
"Error found on line :1 in file :2".
The translated string could then be:
"Error dans le fichier :2 sur la ligne :1"
Notice how the order of the arguments was changed.
So this construction has the advantage that the sequence of :1 and :2 can be modified in other languages, and that the application will not crash if there's an error in the translation.
There's probably some nice C++ class to implement such construction.
Now how do I specify that :1 is my LineNumber, and :2 is my FileName?
Is it possible to put something like this functionality in a C++ class, and make it work similar like cout? Or does this already exist? Anyone ideas on how to find or write this ?

Enjoy life, this is not a rehearsal !!!
GeneralRe: Format strings and iostream Pin
benjymous30-Sep-02 0:05
benjymous30-Sep-02 0:05 
GeneralRe: Format strings and iostream Pin
Patje30-Sep-02 6:05
Patje30-Sep-02 6:05 
GeneralRe: Format strings and iostream Pin
jbarton30-Sep-02 7:08
jbarton30-Sep-02 7:08 
Questionfile manage, private property of microsoft? Pin
includeh1029-Sep-02 20:25
includeh1029-Sep-02 20:25 
AnswerRe: file manage, private property of microsoft? Pin
Andreas Saurwein30-Sep-02 3:27
Andreas Saurwein30-Sep-02 3:27 
GeneralCDocument, help!!!! Pin
includeh1029-Sep-02 20:08
includeh1029-Sep-02 20:08 
GeneralRe: CDocument, help!!!! Pin
jhwurmbach29-Sep-02 21:27
jhwurmbach29-Sep-02 21:27 
GeneralCOM related Pin
Shamoon29-Sep-02 18:59
Shamoon29-Sep-02 18:59 
GeneralRe: COM related Pin
Anonymous29-Sep-02 19:45
Anonymous29-Sep-02 19:45 
GeneralRe: COM related Pin
Stephane Rodriguez.29-Sep-02 19:48
Stephane Rodriguez.29-Sep-02 19:48 
GeneralSecure Internet download Pin
DarrollWalsh29-Sep-02 18:13
DarrollWalsh29-Sep-02 18:13 
QuestionHow to create VS.NET Tabview for different kinds of MDI documents Pin
Anonymous29-Sep-02 17:57
Anonymous29-Sep-02 17:57 
GeneralHandle Problem Pin
chen29-Sep-02 17:30
chen29-Sep-02 17:30 
GeneralRe: Handle Problem Pin
Christian Graus29-Sep-02 18:34
protectorChristian Graus29-Sep-02 18:34 
GeneralRe: Handle Problem Pin
valikac29-Sep-02 18:48
valikac29-Sep-02 18:48 
GeneralRe: Handle Problem Pin
chen29-Sep-02 20:02
chen29-Sep-02 20:02 
GeneralRe: Handle Problem Pin
jmkhael29-Sep-02 22:43
jmkhael29-Sep-02 22:43 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.