@# Quotes DB     useful, funny, interesting





Google
 
Web www.quotesdb.info
Undernet  |  EFnet  |  Quakenet  |  Freenode  |  Dalnet  |  Ircnet  |  Galaxynet
Page: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21



Comments:

<0> Nice
<0> I'll have to look into it at some point
<1> rdragon: I still havent gotten that serial port as a global..
<1> rdragon: and I've yet to find any book about it
<2> anonimasu - I didn't know what you were talking about when you asked it, and I still don't
<1> rdragon: I have a serial port component that I would like to create globally
<1> rdragon: so I can access it from other forms then the form where it's placed in..
<2> I don't know what you mean by "serial port component"
<2> what forms?
<1> "serialport"
<2> is this C++ ?
<1> yes, c++/cli
<2> oh
<1> I got told to use gcroot<^>
<2> is "serialport" an unmanaged cl***?
<1> no, it's a managed cl***



<2> okay
<2> and you want it to be a singleton
<1> singleton?
<2> one instance
<1> yeah..
<1> creating 5 different ones and destroying them is just stupid when I want a persistant connection
<1> :)
<2> public ref cl*** SerialPort{ static SerialPort^ instance; static SerialPort^ GetInstance(){ if( instance == nullptr ) instance = gcnew SerialPort; return instance; } };
<2> (I think)
<2> I mean, that's the general idea, syntax may be wrong
<1> hm, I think the trouble is that it wont allow you to make it a global
<2> global? GetInstance is a static function
<1> hm it compiled
<2> SerialPort::GetInstance()->Blah();
<2> though, I do hate the look of that
<1> yeah
<1> hm, apparently you need to keep the serialport within a cl***..
<1> b SerialPort; return ; } };
<1> whoops
<1> wrong line
<1> System::IO::Ports::SerialPort^ serialPort1;
<1> thats how it looks inside of the form
<2> no need
<2> I really don't understand what the trouble is
<1> hm, my poor understanding of /cli
<2> I thought you wrote the SerialPort cl***
<2> oh, I guess I didn't actually ask that
<1> ah no, :)
<1> if I did it wouldnt be a problem..
<2> is this a web application?
<1> no
<2> well then just throw System::IO::Ports::SerialPort^ serial_port; into a header file, and in Main(), serial_port = gcnew System::...::SerialPort;
<2> that would make it global, but why can't you just p*** it around?
<2> or if you have some kind of 'application' cl***, make it a member of that (probably the preferred way)
<1> hm, yeah..
<1> might write a cl*** to handle all comms for me..
<1> hm found out how now :)
<3> I am trying to print this number with printf() (I find it easier to format with it)
<3> 0.0003884829821
<3> how do I print that using %f
<2> corstan... go to #C
<1> rdragon: Thanks for the help :)
<4> corstan, #include <iomanip> then cout << precision(14) << float_var << endl;
<2> setprecision
<3> ah, ok thanks
<4> or you could use ios::setf(something or other)
<4> I could grep for it :) I know I have used it once in coding
<2> corstan if you're going to use C++ you have to really use it, not just use everything you knew from C
<3> I like printf
<2> then why use C++ at all?
<4> corstan, this is a C++ channel which is why I gave you a C++ answer :)
<4> corstan, ok here we go -->
<4> cout.setf(ios::fixed, ios::floatfield);
<5> using printf() doesn't make it not C++
<4> cout.setf(ios::showpoint);
<3> it's just more convenient to cout'ting around :)
<3> easier
<2> not really
<4> cout.precision(14);
<1> cout is convenient :)
<2> streams are much more extensible and safe



<4> :) enjoy corstan, you may not have to #include <iomanip>
<2> printf( "%d", 14, 12 ); //oh ****
<2> MyStruct s; ... cout << s;
<2> file << s;
<2> cin >> s;
<4> corstan, did you have any luck with that?
<5> cout << printf("%c", cin.get()) << endl;
<2> ...
<4> cn28h, o_O
<4> cn28h, no
<3> threat, thanks
<3> rdragon, I find it easier to format output <-- that is what I should have written
<2> that's likely only because you haven't learned how to do it using streams
<2> and it doesn't look like you find it that easy, considering your current question
<2> the bottom line is that printf-like functions are unsafe by design, and offer no extensibility
<5> printf-like functions do offer some things that streams don't, though
<5> like being able to generate a format string on the fly
<5> and p*** it any number of arguments (vprintf())
<2> can't say i've ever desired either feature yet
<2> though, there is boost.format
<5> bah, right now I'm implementing a sort function with void * and function pointers in C++ (not by choice)
<2> what are you sorting?
<5> arrays
<5> of any type
<2> built-in arrays?
<5> hm?
<2> sorting arrays, or elements within arrays?
<5> ah, well it's sorting elements within an array
<5> it should be easy, but I'm screwing something up somewhere
<2> using void* for what?
<5> for arbitrary types
<2> boost::any ?
<5> I don't think boost is an option
<2> you've got an array of void* ?
<5> no, it's a void* to the beginning of an array
<5> if I were designing it I'd just use templates
<2> and where do you store/get information about the array?
<5> it's all p***ed to the function
<5> number of elements, element size, compare function
<2> what's it for?
<5> my OS cl*** (just a "review" of C and C++)
<2> i mean, why isn't it just a std::vector, or some other nice container?
<2> ah
<6> is Debian a good Linux Distro?
<5> because the files haven't been updated in probably a decade
<2> cl*** trumps all ***umptions of reasonability
<3> javaq, depends on what you mean by good?
<3> if you never used Linux before, why no
<3> t
<5> debian has a pretty good reputation
<2> javaq - good for what? I've used debian in the past on production servers with success
<5> but I've never run it myself
<2> can't recall complaining about anything
<6> k thanks
<5> Slackware is nice if you're looking to try something
<5> it's been my main distro for almost 2 years now
<6> cn28h: how about Ubuntu?
<5> well, Ubuntu uses gnome, and I prefer KDE
<5> but it seemed pretty nice
<5> I ran it via liveCD on my laptop
<1> hm, how do I find out what exceptopn that gets thrown?
<2> use your debugger
<2> or catch each possibly thrown exception
<3> javaq, why not just play with Knoppix ?
<3> or get VMware
<3> "get" :)
<1> hm h
<3> catch(...) { and something ?}
<1> ye
<1> err yep..
<5> heh damn, I had i where I should have had j in one place ...
<4> corstan, np
<3> :)
<3> cn28h, jeez


Name:

Comments:

Please enter the result of the sum 63 + 46 (to avoid spam):






Return to #c++
or
Go to some related logs:

saeed sakuee picture
#linux
ray allen ventriloquist
#networking
#linux
opmanager cacti
problemas gcc kubuntu
resize mount: /usr not mounted already, or bad option
nasm fixed address
DIVXPORNO



Home  |  disclaimer  |  contact  |  submit quotes