| |
| |
| |
|
Page: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
Comments:
<0> um, since when? <1> std::strings have iterators too <2> I don't know, but it seems so <1> you can treat them as another sequence <1> std::string::iterator iter = s.begin(); //first character <1> iter++; //now *iter is second character <2> for )int i = 0; i < str.length(); i++) <1> yes they also have operator[] availab;e <2> nice <2> maybe that's all I needed <1> MAYBE <1> dum dum dum\ <2> lol <0> heh <2> let me try it, <0> well, there is another way... too
<2> btw [] doesn't work and neither str.at(i) <2> I don't know why they don't work though <0> well, there are substrings or you could do str.c_str[i] ? <0> err <0> no that aint right <0> what are you going to use the end result for? <2> parse a string to format it with one plus sign between each 2 words no matter how many spaces <0> oh ok. <2> I'm trying to learn C++ after working with delphi and then pascal <0> I owuld probably use a stringstream <0> the stringstream will automagically remove any excess whitespace <2> yes I used a stringstream with vector as container and it worked <0> and you can put the peices back together however you want <2> but I wanted to step through the string <0> well, you would not even need a vector in theory. <2> one character at a time <0> just a std::string for output, and a stringstream <0> and a temp std::string. <2> hmmm I found an example that did that but while using a vector <0> and std::string does support [] iirc <0> I don't know what you may be doing wrong <0> as well as substr <0> but stringstream and a temp std::string works rather well. <2> let me post the code I used <2> do you have a minute <0> ya <3> in c++ inside a while loop. do i have to use count++ or ++count? <3> Twister <3> post or pre <3> wtf <4> most of the time it doesnt mater <3> ta <0> you have to understand how they work... <0> ++i; is guaranteed to be as fast or faster than i++; <0> so ++i; is generally a good habit if the post/pre part is irrelevant <2> http://www.noidea128.org/sourcefiles/16033.html <0> http://www.noidea128.org/sourcefiles/16034.html <0> thats what I came up with <0> oh geez <0> your code requires no logic at all... <0> heh... <0> use >> operator and all the work is done for you <1> heehee <0> its my logic, just with cin instead of ss <0> So, copy my code, and replace the ss with cin and presto Done. <2> that's cool and I appreciate it <0> well, you would want to modify the loop logic slightly with a break parameter of some sort <2> but stepping through a string should work though, or what am I doing wrong? <0> I dunno <0> it don't compile? <2> I actually typed it in that's why it took some time, because I don't actually have the full code now, because it wasn't working so I erased it <0> you should use string::size_type <0> instead of int ... <2> it doesn't compile because compiler complains about different types <2> ok I'll try that <2> thanks, now I have a couple of things to actually work on. <0> I like my version better than the whole substring search idea though ;) <2> thanks Twister for your help <2> lol
<2> it's going to be one line so not much penalty for slowness <0> you calling my method slow?! <0> boo hiss ;) <2> but I thought it important concept to be able to step through a string (although not most elegant or efficient for this particular case) <0> does the size_type change work? <2> lol no I'm defintely calling my method slow <2> haven't tried it yet, hold on and I'll be back in 2 minutes let you know <0> I think your method may be broken as well <0> buggy on strings of 3 spaces I think <2> the logic is based on pascal's method of working with string <2> so not the best for C++ <2> be back in 2 minutes <0> well, I am outahere. <0> Have a happy. <2> you too Twister <2> working on it now <4> Need help, http://www.noidea128.org/sourcefiles/16035.html. This is ATL & Automation stuff, need help desperately <5> try CoTaskMemAlloc instead of new <4> should I used sizeof(OBZ) in CoTaskMemAlloc(size_t size) ? <5> yep <4> OBZ *obz = (OBZ*) CoTaskMemAlloc(sizeof(OBZ)); //this is my modification <4> it give the same error <2> yes tried with string::size_type and I get the same errors as before :) ISO C++ forbids comparison between pointer and integer. <2> will try now with iterator <5> still, you should never use new to give back memory to a caller across apartment boundaries; you should always use CoTaskMemAlloc <4> point taken... I am reading somemore in MSDN regarding this CoTaskMemAlloc <5> other than that, things look alright to me <4> thanks ... I'll trouble shoot some more ... maybe this code just doesn't work in C#, I am going to try it from VB <5> i think i know what's wrong <4> if I use the DLL from VBit doesnt crash but the OBZ object return from the DLL is basically empty object, all BSTR member are equal tu "" <5> let me try something, hold on <4> thanks peterhu... really appreciate your help <6> khan, once you figure his stuff out, http://planetbattlefield.gamespy.com/ <5> noobs, what happens if you comment out the CoTaskMemAlloc line? <4> let me try that <4> OBZ *obz; // = (OBZ *) CoTaskMemAlloc(sizeof(OBZ)); <-- runtime error: Object used without being defined <5> oh, sorry <5> i meant comment out the line and allocate directly on the pointer p***ed to you <5> i forgot you were using a temp <4> I have been wondering if I can do something like this... <4> OBZ obz; obz.Type = "P"; ... obzData = &obz; return S_OK; <5> works fine here: struct Data { BSTR s1; BSTR s2; BSTR s3; ) ... interface IFoo { HRESULT GetData([out, retval] Data* data); } STDMETHODIMP GetData(Data* data) { data->s1 = ::SysAllocString("hello"); ... S_OK; } C#: Foo foo = new Foo(); Data data = foo.GetData(); Console.WriteLine(data.s1); ... <5> } <5> L"hello" <5> was typing that out <5> you'd obviously want to check data for zero and return E_POINTER <5> you can't do it that way, noob <1> lol <1> oh <1> his real name is noob :-\ <4> :P ok I'm just asking <4> I'm still trying to ***imilate the refference things from thiw few weeks input <5> the COM proxy will p*** you a valid addess of a structure to fill out <4> Ahhh! <4> let me try that <4> thanks a lot <5> no prob <5> for you to have allocated the structure yourself, you would have taken a OBZ** <5> which also works in C# code, but it's uglier, as you have to use the Marshal cl*** to get the structure from the pointer, and then to free the memory that was allocated in the method <4> this is really educational!!! <4> It's good that I dont have to do that marshaling thing... <5> if your method had taken OBZ**, the "[out, retval] struct OBZ**" would have been changed from returning an OBZ interop object to an IntPtr (because you're really returning an address) <5> yeah, you should be fine now <5> "would have been changed" = "would have been changed by tlbimp" <5> that's the first time i've touche COM in almost a year and a half <5> +d <1> how does it feel <5> i feel slightly dirtier <1> I meant after touching COM, not after touching JB <6> Boink <5> jb throw the patch on a server you punk *** bitch <5> fileplanet = the **** <6> Blow me, soccer mom
Return to
#c++ or Go to some related
logs:
cierro sesion y se me reinicia #javascript prv me #linux mr-samoo #chatzone #linux #php statue overlooks Piccadilly Circus snort_inline redirect
|
|