| |
| |
| |
|
Page: 1 2 3 4 5 6 7 8 9 10 11 12 13
Comments:
<0> can i use getline() on char * ? <0> i mean, std::getline() <1> std::istream::getline() sets the \0 character. So strlen() is what you're supposed to use. <0> okay <1> std::istream::getline() also sets the failbit if 0 or n-1 (19 in your case) have been read. <2> cine ma poate ajuta ? si are rabdare un picut? <3> hi <3> how can i fix this error <3> L'espace de noms ou le type 'Odbc' pour les Imports 'Microsoft.Data.Odbc' est introuvable. <1> Try again in Engish, CeapaVerde. <2> :P <2> but i want some help in PRV <2> because im to novice :P for the rest <4> you have to translate it to english first of all :) <0> so, i can check for that fail bit to check, whether it read more than 19 chars, right? <0> how do i check?
<2> ... <0> cin.fail() ? <1> exactly, DontDo. <3> 'Odbc' for Imports 'Microsoft.Data.Odbc' is not found <5> kelly- : thats not a C++ error try #c# <4> kelly- i guess it's a c# syntax. <0> cool, so no need for strlen <1> (so called "managed C++" is not C++) <1> DontDo: failbit also gets set when nothing was read. <2> hmm im a begginer.. i don;t know c++ but i want to learn <2> please tell me the first steps.. <5> CeapaVerde : buy a book <1> CeapaVerde: get a good book. <1> calc koenig2 <6> koenig2 = "Accelerated C++: Practical Programming by Example", Andrew Koenig, Barbara Moo, Addison-Wesley, 2000. ISBN 0-201-70353-X. <2> nooo i don't have money <1> calc thinkc++ <6> thinkc++ = Free Electronic Book for Download: Thinking in C++, Second Edition, Volume 1& 2 - http://www.mindview.net/Books/TICPP/ThinkingInCPP2e.html <2> oke <2> :D <5> and another option is : http://cplus.about.com/od/beginnerctutorial/l/blcpptutorials.htm <1> Then get a texteditor and a compiler. Then spend a lot of time with all three of them. <1> calc compilers <6> compilers = See the 'Compilers' section at http://www.rafb.net/efnet_cpp/compilers/ for links to free compilers. <7> Question: How do i check if a string is a number? Do i need to convert from string to int ? <1> That would be a good idea, Bjprn-. After all, the string could contain a number, but the number could be too large. <1> If you don't care about the too-large condition then you could check whether it contains only digits. <1> (check for an optional sign and for the decimal point if applicable) <7> _m_: how is checking if it's digits done? <1> By checking whether each character is a digit. <cctype> contains the std::isdigit() function for checking a single character. <7> hehe, was way easier than i thought... <7> thansk anyway <0> is it better to keep all the cl*** declarations in one file say mycl***es.cpp, and include mycl***es.cpp in the other files where we define the member functions for the cl***es <0> or keep each cl*** declaration, and member function defnitions in individual file. which is better? <5> you include .h files not .cpp <0> one complete cl*** in one file seems good. isn't? <5> one complete calls definition in a .h file is good <5> put the definitions in one .h file <0> bealtine, you mean, cl*** declaration + member function defnition. right? <1> (that's cl*** definitions, not function definitions) <0> or, do i need to seperate the cl*** declaration and member function defnitions for those cl*** <2> hey thanx verry much <5> yes <0> okay <0> if i have cl*** A{}, objects of which i want to write to myfile.dat. right now i am doing it with ofstream.write(). is there any better way? <0> it will be easy, if am able to say like ofstream ofile("myfile.dat"); A myobj; ofile<<myobj; <0> i guess, i need to overload the << operator for my object. right? <0> can i overload ofstream, the same way like ostream& operator <<(ostream &obj,A aobj){ obj<<aobj; return obj} ? <8> DontDo you don't need to overload for ofstream <8> since an ofstream ISA ostream <0> oh <0> my cl*** data members are , (sorry, am told not to use strings now ) <0> char cust_id[20]; <0> char cust_name[20]; <0> char cust_address[100]; <0> so the problem is, name and address will be having spaces in it. and while trying to read back from file, its only reading word by word <0> so, not able to read the way that i wrote in to the file. is there any solution for this? <0> http://www.rafb.net/paste/results/VB0FvZ68.html , here is the code <0> do i need to do with ofstream.write() or can i do the same with streams? <0> i mean, with << and >>
<9> DontDo: are you not using getline() to read from the file ? (***uming the name and address are each on a separate line) <8> DontDo depends on what you're trying to do <8> telling us the problem instead of your solution (which isn't working) would be helpful <0> the problem is to write customer records to a file <0> and need to read it back, then should be able to modify the record. <8> is this for school? <0> not school... its training for a company <8> and they want you to use array of char rather than std::string? <0> this is a project asked to do, inorder to be familiar with file handling <8> and they want you to use array of char rather than std::string? <0> yes vawjr, that is the most dissapointing <0> if it was string, things would have very very easy <8> and apparently they want you to use a binary file instead of text <0> yeah...., with binary am done <0> i just thought, whether is it possible to do like this <0> is there any way to do with text files? <0> ofcourse, i need to search for a particular record, modify etc. <8> you'll have to "mark" the ends of your fields and the ends of the records <8> you need to modify in place? <0> yeah, i should be able to modify the individual values <8> this is bull****...nobody is doing that these days, everyone is using database back ends <0> like, address, name etc <0> they told to simulate as if like a database. :) <8> well, among other things, you'll be doing non-standard C++ stuff <8> btw, you don't need to overload ifstream and istream separately <0> okay.... <8> .....BUT.... if you're planning on re-writing stuff istream and ostream won't work <8> you MUST have files <0> yo mean, binary files? <0> or else, i need to read sequentially from one file and write to another file, after modification. right? <8> bingo <0> :D <8> for that you could use just streams <8> do they care if you read and write the entire "record" at a time? <0> nope <0> the order of the record should not change... <8> if you want to use >> and << with binary files I posted a couple years ago a simple cl*** to handle it <0> if i use string instead of char* in the program that i posted, will it work? ( i mean, will the multiple words for one field problem get solved) <8> http://noidea128.org/sourcefiles/853.html <0> let me see... <8> DontDo no <0> okay <8> >> on a char* or std::string (text file) will skip whitespace, read data until whitespace <0> hmm <8> so if you want embedded spaces you have a few choices <8> 1) use binary files <8> 2) translate all the spaces to somethign else "_" for example <8> 3) delimit the fields and records (this will likely require NOT updating in place <0> the most easiest is binary file.. :) <8> if you use the link I posted you can do customer c; file >> c; and it will work <0> :) <0> most of the things, am not able to understand in that cl***. :) <0> what is reinterpret_cast? <8> most people have no clue how to teach C++ <0> true... <0> here what is happening is, they are doing C in C++ <0> nothing more... not even covering Strings, STL etc <8> yes, many people don't understand C++ at all <8> they think C++ is C with a couple additions <0> exactly <0> i once argued that, they both are totally different, only the syntax is same, and c++ supports C for compatibility <8> that's how I see it <0> :) <8> but "procedure oriented design" weenies think that a cl*** or two makes them OO experts <0> i would like to think in this way bcoz, that will help me to easily distinguish between C and C++ <10> Zzz <10> zz <11> hi, I have a function f() that takes an f(ostream&) as a parameter, I was wondering, when I call that function, how do I p*** cout as the stream <10> f(cout); <11> that easy, huh <11> :) <11> got it working, thx <8> well, it's kinda hard to split up the theta
Return to
#c++ or Go to some related
logs:
amaria2006
#linuxhelp #php register_globals set_ini write permission on ntfs from suse javascript pick filefield path googlerank.php #chatzone What race of people suffered an estimated 35 million deaths at the hands of the #windows
|
|