From owner-freebsd-questions@FreeBSD.ORG Sat Sep 12 09:38:18 2009 Return-Path: Delivered-To: freebsd-questions@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E26D3106568B for ; Sat, 12 Sep 2009 09:38:18 +0000 (UTC) (envelope-from bsam@ipt.ru) Received: from services.ipt.ru (services.ipt.ru [194.62.233.110]) by mx1.freebsd.org (Postfix) with ESMTP id 6D8AD8FC08 for ; Sat, 12 Sep 2009 09:38:18 +0000 (UTC) Received: from bb.ipt.ru ([194.62.233.89]) by services.ipt.ru with esmtp (Exim 4.54 (FreeBSD)) id 1MmP3g-0002nM-LL for freebsd-questions@FreeBSD.org; Sat, 12 Sep 2009 13:38:16 +0400 From: Boris Samorodov To: freebsd-questions@FreeBSD.org Date: Sat, 12 Sep 2009 13:38:16 +0400 Message-ID: <53480375@bb.ipt.ru> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Subject: c++: invalid conversion from 'int' to 'const char*' X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Sep 2009 09:38:19 -0000 Hello List, I'm porting a c++ application to FreeBSD. I've got an error: ----- ~/work/src/FileChannel.cpp: In member function 'QString FileChannel::errorString()': ~/work/src/FileChannel.cpp:251: error: invalid conversion from 'int' to 'const char*' ~/work/src/FileChannel.cpp:251: error: initializing argument 2 of 'char* strcpy(char*, const char*)' *** Error code 1 ----- A simle patch makes the application to be compiled without errors: ----- --- src/FileChannel.cpp.orig 2009-09-12 13:08:28.000000000 +0400 +++ src/FileChannel.cpp 2009-09-12 13:08:41.000000000 +0400 @@ -248,7 +248,7 @@ QString FileChannel::errorString() { - strcpy(lastErrorString, strerror_r(errno, lastErrorString, 0)); + strcpy(lastErrorString, "XXX: Fix me: errno should be here"); return QString(trUtf8(lastErrorString)); } ----- If I understand correctly, an integer value which is returned by strerror_r() should be converted to const char*. I have _very_ basic knowledge about c++. Hence my question. Can someone provide a patch (a proof of concept)? Thanks! -- WBR, Boris Samorodov (bsam) Research Engineer, http://www.ipt.ru Telephone & Internet SP FreeBSD Committer, http://www.FreeBSD.org The Power To Serve