LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 02-12-2003, 08:10 PM   #1
JStew
Member
 
Registered: Oct 2002
Location: North Atlanta
Distribution: LFS
Posts: 229

Rep: Reputation: 30
For C++ is there an equivalant to "apstring.h"?


With Borland and M$ compilers I used apstring.h for handling strings. Is there a Unix equivalant that anyone knows of?
 
Old 02-12-2003, 08:27 PM   #2
Palin
Member
 
Registered: Feb 2003
Location: A Meatlocker, well feels like one
Distribution: Gentoo
Posts: 292

Rep: Reputation: 30
what kindof functionality does it provide?
 
Old 02-12-2003, 09:04 PM   #3
JStew
Member
 
Registered: Oct 2002
Location: North Atlanta
Distribution: LFS
Posts: 229

Original Poster
Rep: Reputation: 30
basically with apstring.h and apstring.cpp you can do this:

#include<iostream.h>
#include"apstring.h"
#include"apstring.cpp"

int main()
{
apstring message("hello world");
apstring message1;

cout << message << endl;
cout << "Enter a message: ";
cin >> message1;
cout >> "You entered " << message1 << endl;

return 0;
}

You can assign strings to it even with whitespaces.
 
Old 02-12-2003, 09:09 PM   #4
Palin
Member
 
Registered: Feb 2003
Location: A Meatlocker, well feels like one
Distribution: Gentoo
Posts: 292

Rep: Reputation: 30
Ah a string class there are a few floating around I'm writing my own with the help of one of my C++ manuals I'm add and changing it some. If you want a copy of mine I'll be more than happy to let you have it.
 
Old 02-12-2003, 09:34 PM   #5
moeminhtun
Member
 
Registered: Dec 2002
Location: Singapore
Distribution: Fedora Core 6
Posts: 647

Rep: Reputation: 30
You can use the <string>.
Here is the example.

<code>

#include <iostream>
#include <string>
using namespace std;

main()
{
string message("hello world\n");
string message1;

cout << message << endl;
cout << "Enter a message: ";
cin >> message1;
cout << "You entered " << message1 << endl;

return 0;
}

</code>

Last edited by moeminhtun; 02-12-2003 at 09:36 PM.
 
Old 02-13-2003, 05:27 AM   #6
JStew
Member
 
Registered: Oct 2002
Location: North Atlanta
Distribution: LFS
Posts: 229

Original Poster
Rep: Reputation: 30
Moe, you come through again!

With g++, did they get rid of all *.h files? Is that extension only set aside for user-created header files?
 
Old 02-13-2003, 05:35 AM   #7
JStew
Member
 
Registered: Oct 2002
Location: North Atlanta
Distribution: LFS
Posts: 229

Original Poster
Rep: Reputation: 30
Palin,

If you don't mind, I'd love any sample of user files I can get my hands on. If you like, you can send it to phil_serittjunkmail@yahoo.com

You spammers and flamers can use it to do whatever evil purposes you may have as well :-D
 
Old 02-13-2003, 10:01 AM   #8
llama_meme
Member
 
Registered: Nov 2001
Location: London, England
Distribution: Gentoo, FreeBSD
Posts: 590

Rep: Reputation: 30
Quote:
With g++, did they get rid of all *.h files? Is that extension only set aside for user-created header files?
In modern C++, the standard library headers do not have a .h on the end. This is becuase their contents are now in the "std" namespace - if you include the same headers with the .h suffix, the standard library funtions get bunged into your current namespace. You can include ANSI C headers under this scheme by prefixing their names with "c" (<cstdio>, <cstring>, <cstdlib>, etc.)

Alex
 
Old 02-13-2003, 11:57 AM   #9
moeminhtun
Member
 
Registered: Dec 2002
Location: Singapore
Distribution: Fedora Core 6
Posts: 647

Rep: Reputation: 30
Yeah. These are the new stardard libraries that replace the old ".h" libraries. Generally, the new libraries are better. ( I haven't gone through detail into it why are they better)
You can still use the one ".h" libraries but you will get a warning message when you compile it.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
bash script: using "select" to show multi-word options? (like "option 1"/"o zidane_tribal Programming 7 12-19-2015 01:03 AM
what is "sticky bit mode" , "SUID" , "SGID" augustus123 Linux - General 10 08-03-2012 04:40 AM
Telling people to use "Google," to "RTFM," or "Use the search feature" Ausar General 77 03-21-2010 11:26 AM
"Xlib: extension "XFree86-DRI" missing on display ":0.0"." zaps Linux - Games 9 05-14-2007 03:07 PM
Can't install "glibmm" library. "configure" script can't find "sigc++-2.0&q kornerr Linux - General 4 05-10-2005 02:32 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:13 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration