[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: cannot pass objects of non-POD type
From: |
John Harrison |
Subject: |
Re: cannot pass objects of non-POD type |
Date: |
Wed, 13 Oct 2004 12:50:19 +0100 |
"Vijay" <vijaypatil78@yahoo.com> wrote in message
a684298b.0410130336.48eef0e2@posting.google.com">news:a684298b.0410130336.48eef0e2@posting.google.com...
> Hi all,
> Im using
> gcc version 3.2.3 20030502 (Red Hat Linux 3.2.3-20)
> on 64bit linux server
>
> im trying to compile following code
> --------------------sam.cpp---------------------
> #include <string>
> #include <iostream>
> #include <stdarg.h>
> using namespace std;
>
> void Write( const char* msg, const char* msg2, ...)
> {
> cout <<msg <<" "<<msg2<<endl;
> }
>
> int main()
> {
> string str("World");
> Write("Hello","Debug out %s" ,str);
No idea what you are trying to do, why pass str to Write when you don't use
str inside Write? Anyway try this
Write("Hello", "Debug out %s", str.c_str());
C strings and C++ strings are not the same.
john