Re: [Dev-C++] Re: newbie string parsing question
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Per W. <pw...@ia...> - 2004-08-18 10:15:49
|
Using C for string manipulation isn't dangerous unless you don't know what to do. Same thing with using a hammer. Don't forget that the majority of all operating systems in existence uses C with great success. file >> first_name still gives you the possibility of loading a multi-megabyte text string, possibly exhausting the available memory. In reality, easy code is good when everything is already controlled, or you don't care about error behaviour. Production quality code normally need extra tests and protection. /Per W On Wed, 18 Aug 2004, [ISO-8859-15] OROSZI Bal=E1zs wrote: > Pascal wrote: > > Why not using the fully std c++ function like <cin> to manipulate > > string input in file? > > Indeed, that would be the simplest. Using C for string manipulation is ve= ry dangerous, and > awkward. Use the >> operator, like this: > > file >> first_name; > file >> last_name; > ... > > where "file" is an "ifstream" and "xxx_name" is a "string". > > -- > Greetings, > Bal=E1zs > > > ------------------------------------------------------- > SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media > 100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33 > Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift. > http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285 > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > |