Solved

CString in linux

Posted on 2003-10-23
7
2,122 Views
Last Modified: 2008-01-09
can I use CStrings in linux? if so what headers do i need to include?
0
Comment
Question by:GaryJoe
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 2
7 Comments
 
LVL 30

Expert Comment

by:Axter
ID: 9608489
You would have to copy the MFC *.cpp implementation file and the header file.

Most of CString will work in Linux/Unix, however you'll have some problems with the CString::Format function.
0
 
LVL 30

Expert Comment

by:Axter
ID: 9608514
You'll find the implementation in the STRCORE.CPP file:
MICROSOFT VISUAL STUDIO\VC98\MFC\SRC\STRCORE.CPP

0
 
LVL 86

Accepted Solution

by:
jkr earned 125 total points
ID: 9608519
>>can I use CStrings in linux?

No. Use STL strings instead, they are portable. See http://www.msoe.edu/eecs/cese/resources/stl/string.htm
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 30

Expert Comment

by:Axter
ID: 9608526
The class declaration is in the AFX.H file.
0
 
LVL 86

Expert Comment

by:jkr
ID: 9608550
>>You'll find the implementation in the STRCORE.CPP

Well, but I strongly doubt that using it on Linux is covered by the MFC license :o)

// This is a part of the Microsoft Foundation Classes C++ library.
// Copyright (C) 1992-1998 Microsoft Corporation
// All rights reserved.
//
// This source code is only intended as a supplement to the
// Microsoft Foundation Classes Reference and related
// electronic documentation provided with the library.
// See these sources for detailed information regarding the
// Microsoft Foundation Classes product.
0
 
LVL 30

Expert Comment

by:Axter
ID: 9608564
There is a replacement class for CString (called CStr) on www.codeguru.com that will work on UNIX/Linux
Check out the following link:
http://codeguru.earthweb.com/string/index.shtml
0
 
LVL 30

Expert Comment

by:Axter
ID: 9608573
>>Well, but I strongly doubt that using it on Linux is covered by the MFC license :o)

I was answering the question from a technical view point, and not a legal view point.
But you're correct.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
SetCurrentDirectory path limit 7 144
How do i run a c++ file? 15 51
How to increment counter variables in ANSI  C (Not C# or C++). 9 40
Coding for the first time 9 62
Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question