Click here to Skip to main content
15,898,681 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Passing a function as a argument to a function? Pin
Chris Losinger26-Nov-04 17:58
professionalChris Losinger26-Nov-04 17:58 
GeneralRe: Passing a function as a argument to a function? Pin
FocusedWolf27-Nov-04 5:35
FocusedWolf27-Nov-04 5:35 
GeneralRe: Passing a function as a argument to a function? Pin
Michael Dunn27-Nov-04 8:38
sitebuilderMichael Dunn27-Nov-04 8:38 
GeneralHelp with formatting a CString Pin
Chris Meech26-Nov-04 9:05
Chris Meech26-Nov-04 9:05 
GeneralRe: Help with formatting a CString Pin
PJ Arends26-Nov-04 10:29
professionalPJ Arends26-Nov-04 10:29 
GeneralRe: Help with formatting a CString Pin
Jack Puppy26-Nov-04 13:14
Jack Puppy26-Nov-04 13:14 
GeneralRe: Help with formatting a CString Pin
Chris Meech29-Nov-04 3:32
Chris Meech29-Nov-04 3:32 
GeneralRe: Help with formatting a CString Pin
Gary R. Wheeler27-Nov-04 2:30
Gary R. Wheeler27-Nov-04 2:30 
Assuming you don't want to do this:
CString str,fmt;
CStringArray arr;
fmt = _T("%s blah %s blah ... %s blah");
str.Format(fmt,arr[0],arr[1],...,arr[]);
I don't think FormatV will do what you want. It's used within functions that have variable numbers of arguments. Any approach like this will also behave badly if there's a mismatch between the number of %s format specifiers and the number array elements.

Something like the following ought to do it:
CString str,fmt;
CStringArray arr;
fmt = _T("%s blah %s blah ... %s blah");
str = fmt;
int offset = str.Find(_T("%s"));
int index = 0;
while ((offset >= 0) && (index < arr.GetSize())) {
    str = str.Left(offset) + arr[index++] + str.Mid(offset+2);
    offset = str.Find(_T("%s"),(offset+2));
}



Software Zen: delete this;
GeneralRe: Help with formatting a CString Pin
Chris Meech29-Nov-04 3:38
Chris Meech29-Nov-04 3:38 
GeneralRe: Help with formatting a CString Pin
Gary R. Wheeler29-Nov-04 15:12
Gary R. Wheeler29-Nov-04 15:12 
GeneralRe: Help with formatting a CString Pin
Chris Meech30-Nov-04 3:18
Chris Meech30-Nov-04 3:18 
Generaladd line number indicator in MFC document project Pin
zhngmm26-Nov-04 8:45
zhngmm26-Nov-04 8:45 
GeneralRe: add line number indicator in MFC document project Pin
PJ Arends26-Nov-04 10:31
professionalPJ Arends26-Nov-04 10:31 
GeneralRe: add line number indicator in MFC document project Pin
zhngmm26-Nov-04 12:26
zhngmm26-Nov-04 12:26 
GeneralArray - Strings of Characters. Pin
raf-sp26-Nov-04 7:13
raf-sp26-Nov-04 7:13 
GeneralRe: Array - Strings of Characters. Pin
suiram4026-Nov-04 7:18
suiram4026-Nov-04 7:18 
GeneralRe: Array - Strings of Characters. Pin
John R. Shaw26-Nov-04 7:22
John R. Shaw26-Nov-04 7:22 
GeneralRe: Array - Strings of Characters. Pin
raf-sp26-Nov-04 7:34
raf-sp26-Nov-04 7:34 
GeneralXP CFileDialog & RichEdit multithreaded app Pin
suiram4026-Nov-04 6:58
suiram4026-Nov-04 6:58 
GeneralRe: XP CFileDialog &amp; RichEdit multithreaded app Pin
suiram4026-Nov-04 10:24
suiram4026-Nov-04 10:24 
GeneralThousands Separator Pin
BRIMID26-Nov-04 6:44
BRIMID26-Nov-04 6:44 
GeneralRe: Thousands Separator Pin
Maximilien26-Nov-04 7:01
Maximilien26-Nov-04 7:01 
Generaldo while loop. Pin
Anonymous26-Nov-04 6:00
Anonymous26-Nov-04 6:00 
GeneralReading Outlook PST files Pin
Kri526-Nov-04 5:21
Kri526-Nov-04 5:21 
GeneralRe: Reading Outlook PST files Pin
David Cader26-Nov-04 6:05
David Cader26-Nov-04 6:05 

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.