CC Compiler barfs when replacing string using istreambuf_iterator.

Hi All,
I am a noobie to Solaris.
The following piece of code when compiled with g++ works fine.
But Solaris CC compiler barfs.
#include <iostream>
#include <fstream>
#include <iterator>
#include <string>
using namespace std;
std::string stlString("test for string.assign() method");
int main () {
  filebuf fb;
  fb.open ("test.txt",ios::in);
  istream is(&fb);
  istreambuf_iterator<char> itr(is);
  istreambuf_iterator<char> end;
  std::cout << "before : " << stlString << std::endl;
  stlString.assign(itr, end);
  //while ((itr != end) && (*itr != '\n')) stlString+=*itr++;
  std::cout << "after : " << stlString << std::endl;
  fb.close();
  return 0;
$ cat test.txt
this is a sample file
$ g++ -m32 -Wall -g istreambuf.cc
$ ./a.out
before : test for string.assign() method
after : this is a sample file
$
==========================
$ CC -m32 -g istreambuf.cc -library=iostream
"istreambuf.cc", line 20: Error: Could not find a match for std::string::assign(std::istreambuf_iterator<char, std::char_traits<char>>, std::istreambuf_iterator<char, std::char_traits<char>>) needed in main().
1 Error(s) detected.Any help is appreciated.
I need the code to be compiled on both (CC and g++).
Any help is appreciated.
Thanks in advance,
Sreekar

The default standard library (Cstd) doesn't have any member templates. For a more standard behavior, you want -library=stlport4 (or possibly stdcxx on solaris 11).

Similar Messages

  • Trim title off of string using the replace command

    Below is a simple task to read in data from a text file to use in account creation.
    Get-Content employee.txt |
    ForEach{
        $ID = ($_ -split ';')[0]
        $fname = ($_ -split ';')[1]
        $lname = ($_ -split ';')[2]
    A problem that has came up which I did not anticipate was titles.  Titles such as MBA etc. throw off the creation of the account. I have a title like this myself an understand why someone is proud to append it to the last of their name because
    they worked very hard to get it.  In this case I need to trim it off to create the account. Below is an example of a data file
    1234;test;user, MBA;
    4567;test;user2 MBA;
    8901;test;user3;
    Thought this would be an easy fix and here is how I attempted to correct it below
    $lname = $string
    $string -replace ",*" -replace " "
    $string
    My thought was a comma or a space could be used to divide the last name the same as I divided the individual fields in the text file with a semicolon. Is there an easy method to do this? The replace seems easy enough but the problem is I'm not familiar with
    the syntax in powershell.

    RegEx is an excellent tool but itt tkes a programmers mind to understand its subtleties.  It is a good excercize in declaritive thinking and in recursive parsing systems.  Once understood the lesson is transferrrable.
    I do not recomment it to new scripters.  After you gains some mastery of a scripting system then RegEx becomes nmuch easier to understand.  I am not a RegEx wizard although I have used it since before it had a name.  It was part of all editors
    before we had PCs.  VI and HPs EDIT,  MsEDIT and others.  EDLIN uses a primitive form of RegEx from the minicomputer era.  Of course EDLIN is no more.
    ¯\_(ツ)_/¯
    I wouldn't necessarily call myself a new scripter, been doing it a few months now and whilst there is definitely a lot more i could learn, i find that when i need to accomplish something i figure it out eventually, it's how i learn best! It does leave me short
    of tips and tricks you'd find in the early chapters of a book though!

  • Received a replacement ipod nano in early January . Works well in a sound system but keeps turning off when earphones are used. tried 3 pair but same result. When tried for support comes up as  expires. Says I have to purchase . Why????

    Received an ipod nano replacement in January. It works in a sound system but keeps turning itself of or loosing sound when earphones are used. I have tried several sets os earphones with the same result. When I just tried to seek support my Serial number comes up with warranty expired although the letter says 3 mths warranty. What gives Apple ??? Any one any advice??/

    This is usually an indication that your headphones are not plugged all the way in.  The white plastic part of the headphones should be flush with the Nano and no silver from the plug should still be visible.  The headphone jacks on the new 6G Nanos are a bit tighter than previous generations, so it requires a bit of extra push to get the headphones to pop all the way in.
    Also check make sure the jack is clear of debris such as lint.
    B-rock

  • [svn] 1594: Update the warning message when outbound throttle policy of REPLACE is used one more time .

    Revision: 1594
    Author: [email protected]
    Date: 2008-05-07 11:10:27 -0700 (Wed, 07 May 2008)
    Log Message:
    Update the warning message when outbound throttle policy of REPLACE is used one more time. Now the warning says this. . .
    Throttle outbound policy 'REPLACE' found on message destination 'MESSAGE_DESTINATION'. The 'REPLACE' throttle outbound policy has been deprecated. Please remove it from your configuration file.
    Modified Paths:
    blazeds/branches/3.0.x/modules/core/src/java/flex/messaging/MessageDestination.java

    hamish72 wrote:
    You can still download as much as you can only a lot slower during peak times off peak will not be restricted.
    Thanks for this explanation. I had taken it that it was at all times.
    As I said in the first place it will be great if they throttle me to 1Mb at peak times as it will be better half the time than I am getting anyway!!!!!!!!!
    hamish72 wrote:
    Have you chased up why your line is so bad, long way from exchange and so on
    Posting your router stats may get advice from someone
    enter for homehub for other routers will differ
    192.168.1.254 in browser click A to Z top right
    then ADSL enter pas and click MORE DETAIL
    POST RESULTS
    Also post results of test at ( best done from master test socket)
    http://speedtester.bt.com/
    Connection Information
    Line state
    Connected
    Connection time
    6 days, 11:57:55
    Downstream
    5,760 Kbps
    Upstream
    448 Kbps
    ADSL Settings
    VPI/VCI
    0/38
    Type
    PPPoA
    Modulation
    G.992.1 Annex A
    Latency type
    Interleaved
    Noise margin (Down/Up)
    5.7 dB / 21.0 dB
    Line attenuation (Down/Up)
    44.6 dB / 24.0 dB
    Output power (Down/Up)
    8.9 dBm / 1.6 dBm
    Loss of Framing (Local/Remote)
    0 / 0
    Loss of Signal (Local/Remote)
    0 / 0
    Loss of Power (Local/Remote)
    0 / 0
    FEC Errors (Down/Up)
    25279 / 134
    CRC Errors (Down/Up)
    700 / 196
    HEC Errors (Down/Up)
    5427 / 142
    Error Seconds (Local/Remote)
    477 / 102

  • Getting Compilation error when used SET or MULTISET operator on nested tabl

    Dear All,
    I am getting Compilation error when used SET or MULTISET operator on nested tables inside a procedure.
    This is working fine in other DB installations of 10g but does not work in another 10g DB.
    it says "wrong number of parameter or datatype used in SET"
    Can any one suggest what went wrong here?
    Thanks in advance.

    Can any one suggest what went wrong here?Only if you would post the query and Oracle versions on both databases.
    Besides, this forum deals with issues in Oracle product installation. So post this query in SQL PL/SQL forum for better response.

  • Compilation error when used SET or MULTISET operator on nested tables

    Dear All,
    I am getting Compilation error when used SET or MULTISET operator on nested tables inside a procedure.
    This is working fine in other DB installations of 10g but does not work in another 10g DB.
    it says "wrong number of parameter or datatype used in SET"
    Can any one suggest what went wrong here?
    Thanks in advance.

    Hi,
    Thanks for ur reply...
    Since MULTISET and SET operators are the new additions in base 10g release for manipulation of nested tables data, I am surprised that same is working in similar 5 DBs installations with 10.2.0.1.0 version, but does not work in the sixth.
    SET and MULTISET operators are used inside the PL/SQL procedure which is getting compiled in the above mentioned 5 DBs but not in sixth DB.
    it gives
    On line: 3112
    PLS-00306: wrong number or types of arguments in call to 'SET'
    Hope this clarifies the issue...

  • [svn:fx-trunk] 13299: fix the _rb swc so that it updates properly when changes happen - update=" true" so that it will compile correctly when using locales

    Revision: 13299
    Revision: 13299
    Author:   [email protected]
    Date:     2010-01-05 19:07:45 -0800 (Tue, 05 Jan 2010)
    Log Message:
    fix the _rb swc so that it updates properly when changes happen - update="true" so that it will compile correctly when using locales
    QE notes: ensure it contains a catalog.xml file, a swf, and a locale directory with properties file
    Doc notes:
    Bugs: https://bugs.adobe.com/jira/browse/SDK-24802
    Reviewer: pete
    Tests run:
    Is noteworthy for integration: no
    Ticket Links:
        http://bugs.adobe.com/jira/browse/SDK-24802
    Modified Paths:
        flex/sdk/trunk/frameworks/projects/framework/build.xml

    I've dropped my guard before with the security and I had so much trouble with my computer because of all the people trying to attack my computer I just can't take the chance again.  www.MySafetyGates.com

  • When is String literal pool created compile time or runtime?

    When is String literal pool created compile time or runtime?

    I have replied to your question in the other thread related to the string pool:
    http://forum.java.sun.com/thread.jsp?forum=31&thread=276893
    Pierre

  • Compile error when using a class by fully-qualified name

    Hi... Is it an AS3 "feature" or a FB compiler bug that I cannot use a class without importing it?
    I have a statement such as
    if (de.codebank.util.StringUtilities.startsWith(status.name, phase.name+"_"))
    which does not compile until I import the StringUtilities class, which is pointless, of course.
    The compile error mentions an unknown property "util"

    I believe this is how AS3 works. Fully qualified class types require import statement.
    You use fully qualified name whenever you want to avoid ambiguity.
    However, when the code is like,
    import mx.collections.XMLListCollection;
    var arr:mx.collections.ArrayCollection;
    It works since compiler now understands that "mx.collections" is a package.

  • To replace "\" with "/" in a string using FrameMaker API

    How to replace "\folder1\folder2\folder3" with "folder1/folder2/folder3" using framemaker API ?

    Hi Asha,
    Here is a function that I use for substring replacement, using all FDK library functions. If you use standard C libraries instead, you could probably reduce this to a line or two.
    To use it, you would send something like:
    path = F_StrCopyString("\\folder1\\folder2\\folder3");
    strReplace(path, "\\", "/", False);
    There might be better ways to do this. I'm not really that much of a programmer.
    Russ
    //returns the index of the first change, or -1 if no changes.
    IntT ws_StrReplace(StringT *mainString,
                       StringT searchString,
                       StringT replaceString,
                       IntT considerCase)
      StringT strBuf,
        returnString,
        appendString;
      IntT i,
        firstIndex = -1;
      //if the search string is empty, there is nothing to do.
      if(F_StrIsEmpty(searchString))
        returnString = F_StrCopyString(*mainString);
      else
        //otherwise, initialize the buffer
        returnString = F_StrCopyString("");
        for(i = 0; i < F_StrLen(*mainString); i++)
          strBuf = F_StrCopyString(*mainString);
          //Truncate the string from the beginning
          F_StrReverse(strBuf, 10000);
          F_StrTrunc(strBuf, (F_StrLen(strBuf) - i));
          F_StrReverse(strBuf, 10000);
          //and lop it down to the size of the search string
          if(F_StrLen(strBuf) > F_StrLen(searchString))
            F_StrTrunc(strBuf, F_StrLen(searchString));
          //if they are the same, we are doing the replacement
          if((considerCase && F_StrCmp(strBuf, searchString) == 0) ||
             (!considerCase && F_StrICmp(strBuf, searchString) == 0))
            appendString = F_StrCopyString(replaceString);
            //set the return value
            if(firstIndex < 0) firstIndex = i;
            //jimmy the loop so we step past the length of the replacement
            //string the next time around
            i += F_StrLen(searchString) - 1;
          //otherwise, we are just appending 1 character on.
          else
            F_StrTrunc(strBuf, 1);
            appendString = F_ApiCopyString(strBuf);
          //now, concatenate
          //rciReturnString = F_Realloc(rciReturnString,
            //F_StrLen(rciReturnString) + F_StrLen(rciAppendString), NO_DSE);
           returnString = (StringT) F_Realloc(returnString,
            (F_StrLen(returnString) + F_StrLen(appendString))*sizeof(StringT), NO_DSE);
          F_StrCat(returnString, appendString);
          F_ApiDeallocateString(&strBuf);
          F_ApiDeallocateString(&appendString);
        } //end main else
      //all done
      F_ApiDeallocateString(mainString);
      *mainString = F_StrCopyString(returnString);
      F_ApiDeallocateString(&returnString);
      return firstIndex;

  • Replacing occurrence of a string Using External tables??

    Hi,
    Is it possible to replace the occurrence of a string using external tables?
    For example, if you were loading a file that contained many fields. One of them was a description field. I want to be able to check this field for a string and if this string exists replace it with another.
    Is this possible with External tables?
    Thanks

    The external table can be used directly like a regular table using SQL if you defined it as PARALLEL 5.
    Access to external files is transparently parallelized, independent of the number of files (intra-file parallelism). The parallelism available through external tables increases performance dramatically compared to serial processing on a file-by-file basis.
    For more information:
    http://www.oracle.com/technology/products/oracle9i/daily/sept19.html

  • [svn:bz-trunk] 21292: Fix BLZ-639 - avoid the use of "==" when comparing strings.

    Revision: 21292
    Revision: 21292
    Author:   [email protected]
    Date:     2011-05-25 12:09:39 -0700 (Wed, 25 May 2011)
    Log Message:
    Fix BLZ-639 - avoid the use of "==" when comparing strings.  Just check for null explicitly.
    Ticket Links:
        http://bugs.adobe.com/jira/browse/BLZ-639
    Modified Paths:
        blazeds/trunk/modules/common/src/flex/messaging/config/ClientConfiguration.java

    Adobe has donated BlazeDS to the Apache Flex community, and the source code is hosted on the Apache Flex website in a GIT repository.
    http://flex.apache.org/dev-sourcecode.html

  • Compilation error when using @DisableWarnings

    Hi,
    I have a stateless EJB 3.0 session bean, and I am trying to add the following lines of code in it:
    @DisableWarnings { WarningCode[] value(); }
    enum WarningCode { BEA_010001, BEA_010200, BEA_010202, BEA_010054 }
    Iam getting a compilation error like this:
    - The annotation @DisableWarnings must define the attribute value
    - Syntax error on token "@", interface expected after this token
    I am also tring to add this:
    @TransactionTimeoutSeconds { int value() default 30; }     
    I am again getting compilation errors.
    I am using Eclipse ganymede.
    Can any body please help me regarding this.
    Thank you,
    Sowmya

    Hi,
    It looks like you are specifying the annotations incorrectly in your bean class. Try the following:
    @DisableWarnings({WarningCode.BEA_010001, WarningCode.BEA_010200, WarningCode.BEA_010202, WarningCode.BEA_010054 })
    @TransactionTimeoutSeconds(30)
    - Matt

  • Search and Replace String throwing the wrong error message with regexp?

    This came up in a LAVA thread, and I'm not sure if there's a bug here or not. When using Search and Replace string, and using a regular expression of [(G[b|i])], LabVIEW throws error -4622, "There is an unmatched parenthesis in a regular expression."  There are obviously no unmatched parenthesis in that expression, so it seems to me that the wrong error is being thrown. I'm just not sure if that's a syntactically valid regexp. The problem seems to be with nesting [ ]'s inside ( )'s inside [ ]'s. I've tried a couple of regexp resources on the Web, and one suggests it's valid, while the other seems to think it isn't.
    Message Edited by eaolson on 03-13-2007 10:33 AM
    Attachments:
    ATML_StandardUnit2.vi ‏10 KB
    regexp.png ‏5 KB

    adambrewster wrote:
    I think your regexp is invalid.
    In regexps, brackets are not the same as parentheses.  Parens are for grouping, while brackets are for matching one of a class of characters.  Brackets can not be nested.
    If the regexp is replaced with [G[bi]], there is no error, so it's not a matter of nested brackets. I couldn't find anything on the PCRE man page that forbids nested brackets specifically, but it makes sense.
    Your expression "[(G[bi])]", therefore parses as a character class which matches '(', 'G', '[', 'b', or 'i' followed by an unmatched paren, and an unmatched bracket.
    I don't believe that's the case. Replace the regexp with [(Gbi)], and the error goes away. So it's not a matter of the '(' being literal, and then encountering a ')' without a matching '('.
    daveTW wrote:
    what string exactly you want to replace? I think the round braces are not right in this case, since they mark partial matches which are given back by "match regular expression". But you don't want to extract parts of the string, you want to replace them (or delete, with empty <replace string>). So if you leave the outer [( ... )] then your RegEx means all strings with either "Gb" or "Gi".
    It's not my regular expression. A poster at LAVA was having problems with one of his (a truly frightening one), and this seemed to be the element that was causing the problem. I'm pretty sure that the originator of the regexp meant to use G(b|i), which seems like a complicated way of matching "Gb" or "Gi", if you ask me.

  • Search and replace string function

    Hello, I am using the "search and replace string" function and it does nt seem to work consistently for me.   I am using it in a situation where I am taking an array of strings, converting this into a spreadsheet string then deleting all of the commas.  Has anyone experienced the same behavior? I have searched through other posts and found other simular faults but none of the fixes worked for this. I can post the code it needed.
    Thanks,
    Andrew

    I agree that commas are often not desirable, especially if your software should also work in countries where comma is used as a decimal seperator.
    Where are the commas coming from? Does (1) each element of the original array have one (or more), do you (2) use comma as seperator if you convert it to a spreadhseet string?
    For (1), you might just strip out the comma for each element right in the loop. For case (2) you would simply use a different separator to begin with, of course.
    Btw: you are abusing a WHILE loop as a FOR loop, because you have a fixed number of iterations. Please replace it with a FOR loop. If you use a FOR loop, LabVIEW can manage memory much more efficiently, because it can allocate the entire output array before the loop starts. For While loops, the total number of iterations is not known to the compiler. (Of course a real program would also stop the loop if an error occurs. In this case you would need to stay woth the WHILE loop. )
    Do you have a simple example how the raw array elements look like. How many commas are there?
    LabVIEW Champion . Do more with less code and in less time .

Maybe you are looking for

  • Cannot log into 192.168.1.1

    Hey, a couple months ago i decided to move my pc and go wireless. Originally had a netgear wich techsupport so helfully destroyed. I returned it and got a linksys wrt54gs v6. I worked great but for some reason i had to reboot my computer ever night t

  • Video, Website and Software incompatibility

    Hi Folks! Three questions about incompatibility on my iMac: 1) The following website will not open or allow me to run their website appllication software, https://www4.webcrf.net/nma53032/pfts.dll?PVN=21678 The site is a pharmaceutical research platf

  • Set the System resolution

    hi all, I want to set the screen resolution in java 1.3. I got the screen resoluion by using Toolkit.getDefaultToolkit().getScreenSize(). Now i want to set the new resolution. Please tell me how to set it. it should be compatible to java 1.3. Please

  • Cant edit song info

    Im having trouble editing my song info. A problem i haven't had in the past. I just got a new computer today, but all of my media is on my external hard drive. On my old pc, i had no troubles editing song info off of these files. and now it seems to

  • Expected impact of under-allocation of swap

    Oracle rdbms 112.0.1 Oracle GI 11.2.0.1/2 Oracle Linux 5.6 x86-64 stand-alone, no RAC Development box is hosting ASM and 3 rdbms instances. databases are at 11.2.0.1, ASM was upgraded to 11.2.0.2 before I inherited it. Prod box is hosting ASM and 2 r