| |
| |
| |
|
Page: 1 2 3 4 5 6 7 8
Comments:
<0> so like.. void funct(const int size) { char test[size]; } <1> Metall|ca, hmmmm, and that doesnt work ? <0> nah, it says storage size of the char isnt constant. <1> also const int &size is probably a better approach <0> so.. in this case "test" <0> ill try <1> oh <1> although to reduce the change of a segfault you probably want to test size within the function first <1> change = chance <1> e.g. if(size <= 0) return; or something :) <1> Metall|ca, where abouts in NSW are you from? <0> hunter valley <1> choice <1> near that power plant? <0> I cant even do the following. const int Size = 256; char test[Size]; <1> hmmmm
<0> Umm, im not too sure.. is that on the freeway to sydney? <1> Metall|ca, yes <0> im near maitland <1> nice <0> yeah, moved here from new zealand 6 months ago <0> oh wait, i can do the following* <0> just not when i p*** the variable through a function call <2> Bah <2> 4am it too early to wake up <1> Ashe`, It is 12:06 PM though :) <0> I even set a global int for it, and it says that the storage size isnt consistant :S <0> Im using static chars, thats why this is happening. but i need to use em <3> hi!! does anyone here could help me. <3> i compiled my program in winxp using Visual Studio 2005, but when i tried to run the exe in another system also winxp <0> You need to have some of the vs2005 files on the other pc also. <0> thats why i stopped using vs2005, and turned to devc++ :) <4> you need to deploy the runtime <4> Metall|ca that doesn't eliminate the 'problem' <4> it's just that VS2k5 is new, and so not many people have the runtime installed <4> ebros - create an installer project for your application <4> you can use that to bundle the runtime into the installer, and it'll take care of installing it <4> also make sure you've built in release mode <3> how can i deploy the runtime? is it included in the framework? <4> if you have the express version of vs2k5, there are different steps <4> ebros the easiest / best way to do it is by creating an installer for your application (it's really, really simple) <4> if you create a new project, under 'other project types' you'll see 'setup project' <3> ok ill try to create an installer. thanks very much rdragon :) <0> MSV2005 Express doesnt have that option rdragon. <3> btw im using the professional edition. does it have the installer feature? <0> It should do if rdragon says so. <4> yes, ebros <4> to your solution, "Add New Project" > "Other Project Types" > "Setup and Deployment" > "Setup Project" <3> ok done. whats next rdragon? :) <4> find some documentation about creating setup projects <4> although if you play with the ide, you could figure it out <3> alright ill just experiment : ) thanks again <0> Funct(const int Size) { static char ch[Size]; } <<when i try this. it says i cant Size, unknown value. and compiles with an error. <4> Metall|ca you can't do that <4> array sizes need to be known at compile time <4> if you need a dynamically sized array, use std::vector <5> in fact whether you need one or don't , just use std::vector <0> I can do this tho static char *ch = new char[Size]; <0> but creating it dynamically doesnt seem to work well with my function. <5> if you're mucking about with strings, use std::string <4> Metall|ca - that's not an array, that's calling new at runtime, and p***ing it a parameter (Size) <4> and it returns a chunk of memory that can be used for Size char's <4> but yeah, use std::string <5> also, buy a book if you want to learn C++ <0> I really dont need to use std::string, Ive made my own function calls to do pretty much the same thing. <5> using char arrays? <0> using chars, yes. <4> then get rid of them, and use std::string <4> i doubt you've written a better string implementation than the library writers <0> i probably havent, but it works fine for me. <5> there will come a point when it will not <5> then you will waste time fixing it, instead of focusing on solving the actual problem at hand <5> C++ is annoying enough as it is, no need to make it more so for yourself <6> or quit compiling things for dlls in vs2k5 and use static linking instead <6> yeah, writing your own string is foollish. Others won't be able to read your code and it's unlikely it will actually work with all the things in <algorithm> <0> vawjr, i dont use vs25k. <0> And also, others dont read my code, as i program for myself :)
<7> that's not due out for a couple years anyway <7> (vs25k) <5> Metall|ca: please take our advice <5> we only suggest it because we care <4> and because it's easier to help when everything is a tangled mess of your own doing <4> isn't <0> lol <0> alright, ill redo everything again using std::string. <4> get a book, too <5> ya that too <0> What for? <5> calc koenig2 <4> to learn <5> boo <0> learn what? how to use std::string? <4> how to write proper C++ <5> http://rudbek.com/books.html <---the first book on there <6> Metall|ca the vs25k comment was for ebros <6> Metall|ca how to write C++ <0> I can write c++ fine :) maybe not at an IT level. <6> if you wrote your own string you can't write C++ fine <0> I never wrote my own string, i made a few functions like std::string has. <6> so you use the strxxx stuff and your own "few functions" ? <1> does cin.read(char*, size); null terminate the string? <7> yesw <7> wai <7> er <7> I'm thinking of getline() <7> hm <1> hmmm <7> I would have to guess no <1> ok <7> I would also guess that it won't stop if you hit enter <7> it will keep reading until it reads how much your asked for or your send EOFE <7> EOF, even <1> your right it doesnt NULL terminate <1> oops I ment ifs.read(); :) not cin ( where ifs = ifstream ifs) <5> same thign applies <1> same thing though <1> yep <1> I thought so <6> threat why wold you care? use std::string .... forget all that char* crap <6> but to answer your question, it does NOT put a '\0' at the end <8> Hi im having problems compiling a program from scheme to C <8> can some one help me? <6> this is a C++ channel, not C, if you really mean C: /join #C main <8> ok <9> hy guys <9> any idea how to dump the ram to a file ? <7> you can get a core dump <10> Join #0p free op (@) <7> (if that helps) <9> how ? <7> I'm not sure the most proper way <7> if you have your OS configured to create them by default, then yo ucould do it by raise(SIGSEGV); <7> though that is sort of a hack <9> what library ? <9> raise is c99 ? <7> POSIX <7> #include <signal.h> <9> just raise ? <7> well that will generate a Segmentation fault <7> depending on your system configuration it may or may not generate a core dump <9> but using pointers do I have a chance ? <7> eh? <7> what system are you on, anyway? <9> xp, fedora4 <7> fedora should be able to give you a core dump <7> I don't know about windows <7> you just want to browse your own processes' memory? <9> not just browse but write <7> erm, why not just use a normal pointer to the data then? <9> void *p =0x0000h; <9> and cout p
Return to
#c++ or Go to some related
logs:
bjeans #MissKitten #chatzone #mirc #linux PURGED THE GREAT PLAGUE issue.net centos 4.2 fifa2003 #c++ Fedora 4GB process 64bit
|
|