BAD BAD COMPUTER!!!
Is there any possible reason that you could fathom that cin.getline(char*,int) could ever in your wildest dreams compile correctly, but come up with an error message at runtime...
plz hlp ASAP!!!
Why don''''t we just kill the guys who write error messages. It''''d make our lives a hell of a lot easier
****************************
Gimme a break, I''''m Just 13 (14 in JULY)
It would help if you showed us the code and told us what the error message is
>> Why don''t we just kill the guys who write error messages. It''d make our lives a hell of a lot easier
And while we are at it, I think we should remove all traffic signs - that way people can't overlook them.
[edited by - felonius on May 29, 2002 9:42:47 AM]
>> Why don''t we just kill the guys who write error messages. It''d make our lives a hell of a lot easier
And while we are at it, I think we should remove all traffic signs - that way people can't overlook them.
[edited by - felonius on May 29, 2002 9:42:47 AM]
Jacob Marner, M.Sc.Console Programmer, Deadline Games
Probably a problem with the char * you''re passing it. Make sure it''s allocated properly and of the correct size.
It''s actually very simple, here''s a short example:
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GED d- s:+ a- C++$ UL++ P++ L++ E W+ N+ o K? w !O M--(+) V-- PS+
PE Y+ PGP t-- 5++ X+ R(+) rv+(++) b+++ DI+ D(+) G e+>++ h r--> y+
----- END GEEK CODE BLOCK-----
geekcode.com
#include <iostream>using namespace std;int main() { char* buffer; buffer = new char[256]; // <-- If you don''t do this you''ll // get into trouble cin.getline(buffer, 255); cout << endl << "You typed " << buffer << endl; delete[] buffer; return 0;}// Alternatively, with the buffer on the stackint main() { char buffer[256]; cin.getline(buffer, 255); cout << endl << "You typed " << buffer << endl; return 0;}
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GED d- s:+ a- C++$ UL++ P++ L++ E W+ N+ o K? w !O M--(+) V-- PS+
PE Y+ PGP t-- 5++ X+ R(+) rv+(++) b+++ DI+ D(+) G e+>++ h r--> y+
----- END GEEK CODE BLOCK-----
geekcode.com
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement