- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Re: C++ STL
Operating System - Linux
1748089
Members
4937
Online
108758
Solutions
Forums
Categories
Company
Local Language
юдл
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
юдл
back
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-17-2006 09:07 PM
тАО09-17-2006 09:07 PM
C++ STL
I want to implement this in C++.I will have one file in which i will define Key and value.
What i want to do is that i wll read file once store all the value in
data structure. And wll do search for that particular key and it should
return me value of that particular Key. Key and Value are string and Key
will always be unique.
Can anyone suggest me better way of doing it Using C++,STL
For Example
file contents are
hello1:def
hello2:cef
Hello3:gef
Hello4:cef
Hello5:cef.
Suppose i search for hello2 it should return me cef.Hope i am clear.
What i want to do is that i wll read file once store all the value in
data structure. And wll do search for that particular key and it should
return me value of that particular Key. Key and Value are string and Key
will always be unique.
Can anyone suggest me better way of doing it Using C++,STL
For Example
file contents are
hello1:def
hello2:cef
Hello3:gef
Hello4:cef
Hello5:cef.
Suppose i search for hello2 it should return me cef.Hope i am clear.
- Tags:
- containers
- map
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-18-2006 01:40 AM
тАО09-18-2006 01:40 AM
Re: C++ STL
Hi,
something along the lines of the attached code. Test comiled with gcc
Parameters:
1. Input filename
2. Key to look for
e.g. ./a data.lis Hello4
If you happy with this solution please award points.
something along the lines of the attached code. Test comiled with gcc
Parameters:
1. Input filename
2. Key to look for
e.g. ./a data.lis Hello4
If you happy with this solution please award points.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-18-2006 05:14 PM
тАО09-18-2006 05:14 PM
Re: C++ STL
Well, i could not find the attached file.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-18-2006 06:00 PM
тАО09-18-2006 06:00 PM
Re: C++ STL
I don't see Peter's example so I wrote my own. Most of the source is fluff to get the file and read it. The only important thing is the STL "insert": m_string[key] = value;
And the find: mss_iter itr = m_string.find(argv[2]);
And the find: mss_iter itr = m_string.find(argv[2]);
- Tags:
- insert
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
News and Events
Support
© Copyright 2024 Hewlett Packard Enterprise Development LP