« first day (261 days earlier)      last day (4679 days later) » 

user379888
9:00 PM
@MartinhoFernandes:VS complains that 'stream' is undeclared identifier
 
In your case stream would be file.
 
user379888
Oh sorry
 
user379888
@MartinhoFernandes: The condition works fine now but my code still got some silly problem :( .. It is displaying '00000' instead of data
 
user379888
#include <iostream>
#include <string>
#include <fstream>
using namespace std;
class Record
{
private:
	string name;
	string rollNo;
public:
	string getName();
	string getRollNo();
	void putData();
	void setData();
};
void Record::setData()
{
	cout << endl << "Enter Name:";
	cin.ignore();
	getline(cin,name,'$');
	cout << endl << "Enter Roll No:";
	cin.ignore();
	getline(cin,rollNo,'$');

}
void Record::putData()
{
	cout << endl << "Name:"<<getName();;
	cout << endl << "Roll No:"<<getRollNo();
}
string Record::getName()
 
What do you think file.read returns?
 
user379888
9:03 PM
It returns a string
 
No it doesn't.
 
user379888
I even casted it
 
It returns an istream&.
 
user379888
Should that do the job?
 
It's istream& read ( char* s, streamsize n );
You are sending an istream& to cout.
That's not what you want, I guess.
 
user379888
9:05 PM
The read() function you just wrote is different then the one I am using?
 
sbi
1 hour ago, by FredOverflow
Brainfuck for Orang-Utans? WTF?
@FredOverflow You would have to have read Pratchett in order to appreciate Ook.
 
It returns the istream& so you can use it in the while condition, like this while(file.read(...)) /* do stuff */; Which will probably work better for you.
 
user379888
No I just want it to convert to string and display data
 
sbi
1 hour ago, by hexa
I need an avatar
 
@JustAnotherProgrammer It's the one you're using.
 
user379888
9:06 PM
@MartinhoFernandes: How should I convert from istream& to string?
 
You don't.
The istream it returns is your file.
What you want to output is the record, right?
 
user379888
Yes, but the record is in the file
 
Oh wait, you can't read a Record with read().
 
this one @sbi?
 
user379888
@MartinhoFernandes: Any idea how should I do it?
 
sbi
9:10 PM
@hexa That'll be very hard to see when displayed as a 16x16 icon. Try harder!
 
You have to read the strings separately. How did you write them?
 
user379888
I am writing them with write()
 
You can't do that either.
I mean, you can, but it probably won't do what you want.
 
@sbi the one I want is the "H" from the House TV show logo, but I think ill have to make it by myself, couldn't find a suitable one
 
user379888
Oh, I just got it :D . I can save it as a string and retrive it back :p
 
sbi
9:11 PM
@hexa Whatever that is.
 
user379888
Thanks
 
@JustAnotherProgrammer If you retrieve them with >> you will only get the first word.
 
user379888
@MartinhoFernandes:How come?
 
Going home, bbl.
 
user379888
@MartinhoFernandes: I will have to do something like, cplusplus.com/reference/iostream/istream/read
 
9:14 PM
@JustAnotherProgrammer Try it with string s; cin >> s; cout << s; and you'll see.
>> only reads until a space.
 
user379888
@MartinhoFernandes: I understand the problem with cin. I stops when whitespace occurs
 
user379888
how about getline() ?
 
You need to devise a way to know where the string ends in the file.
getline() is one option.
 
user379888
Cool :D
 
If the string cannot have multiple lines (which makes sense for a name).
 
user379888
9:16 PM
getline is also used for multiple lines. I will have to use a terminating condition
 
user379888
which in this case should be EOF
 
user379888
brb
 
@CatPlusPlus I've seen the future. It's cleaner, nicer and more consistent. Most importantly, it ain't C++.
 
@ChristianSciberras Again, everyone agreed C++ sucks.
No need to keep saying as if it was an argument for something else.
 
Thought I should remind him ;)
 
9:23 PM
I doubt that will change his opinion in the least.
He seems to know what is talking about.
 
That won't change mine neither.
 
@ChristianSciberras I assure you, c++ is not going away, just like java, php, ruby, anything else
all flames about languages are pointless
 
@KamilTomšík Sadly...
You know, people should use brainf*ck more often.
At least, it's consistent.
 
@ChristianSciberras not sadly, sometimes you do want performance, on primitive level...
 
sbi
LHR T5 is futuristic. But I dont remember there being queues in the future. Maybe everyone flys business in the future
 
9:27 PM
lol
 
A flame is a message sent with the deliberate intent to insult.
 
you know, if I used MSVC10 as a back-end, all I'd have to do is be able to parse a new language and then put it backout
 
sbi
@ChristianSciberras It's easy to be consistent when your language only has half a dozen features and is all invented on one sunny Sunday afternoon. The hard part is to stay as consistent as possible given a 25 year old Moloch like C++.
 
@KamilTomšík - "performance on a primitive level" ain't C++. I hate C++ for what it looks like, not for what it does (even if it does things badly anyway).
 
@DeadMG You need to output C++ though.
 
9:29 PM
sure
 
@sbi - Ask @KamilTomšík about that.
 
but C++ with no macros, no templates, maybe no inheritance
etc etc
 
sbi
@ChristianSciberras Why would I do that?
 
'Coz he knows all about keeping a language( syntax) small, simple and effective.
 
@sbi Moloch as in the ancient god that requires child sacrifices, or Moloch as in the child sacrifice?
 
sbi
9:31 PM
@ChristianSciberras Does my statement look like I need advice on the matter?
 
@ChristianSciberras yes, c++ is not the best language ever, but it is #1 choice for game programming - for example
 
Xeo
Anyone in for some fun?
 
Perhaps C++'s problem is that it should have been dropped a long time ago. And no excuses on performance, this isn't language internals, but plain syntax.
 
@Xeo: What do you have in mind? Today is a grumpy day and I want to grump have fun
 
@sbi Your statement looked like a question, I provided the answer.
 
sbi
9:32 PM
@MartinhoFernandes Either.
 
Xeo
@DeadMG Oh, you will love it! I want to rip apart this pathetic "FQA" which has just absolute non-sense in every word written there.
 
it nicely integrates with all libs, there are a lot of tutorials, each successful language has its own interest area, and c++ is successful - maybe not for server-side programming, but that doesn't matter
 
Xeo
I will call it the FQFQA - Frequently questioned FQAs
 
sbi
@ChristianSciberras You might want to learn to take a little more time to read.
 
@Xeo: Ripping that apart is a matter of trivially poking it
 
9:33 PM
@sbi - Sure and C++ is going to help all the way, with some overflows during the way...
 
Seems like everyone today is bent on bashing something.
 
@Martinho: Hey, I'm bent on creating something
 
Xeo
@MartinhoFernandes Wait, when? I will not agree with that!
 
@ChristianSciberras overflows? why?
 
@KamilTomšík - You're hilarious!
 
9:35 PM
@ChristianSciberras ever heard about smart pointers?
 
sbi
@ChristianSciberras <plonk/>
 
@Xeo You weren't here.
 
@ChristianSciberras: You only get overflows in C++ if you haven't coded in it for a decade
everyone else uses bounds-checking classes
 
@KamilTomšík Are you subscribed to security lists?
 
9:36 PM
I think I'll try out that ignore feature now.
2
 
I just received an email, 4 hours ago. Another issue with a linux app that simply forgets to count the arguments passed to it, and proceeds to copy all of them in a smaller buffer.
 
Xeo
@ChristianSciberras Ouch
 
Sure it's bad code. Even worse, it's a trivial mistake. I'd like to see myself do it in javascript, PHP, or whatnot. Oh wait, I can't.
 
Xeo
So, anyone wanting to take part in the comment discussion here?
 
well, you can trivially copy your command line arguments by doing something like std::vector<std::string> cmdline(argv, &argv[argc]);
2
@Christian: Sure, but those languages can't offer performance, or control, or a dozen other things that C++ does
 
Xeo
9:39 PM
@DeadMG Hell, they don't even have templates!
 
@DeadMG This guy thought he'd be wise to do it manually, C-style. :P
 
in those languages, for example, you can make typing errors
those don't exist in C++
 
@Xeo - OMG not templates, no!!! </sarcasm>
 
Xeo
templates eat what generics simulate for breakfast.
 
9:41 PM
@ChristianSciberras calm down, c++ sucks at oo, sorry guys, it really does... yet it's still better language whan c or even asm - and sometimes you just can't afford virtual machine
 
@Kamil: What makes you say C++ sucks at OO?
 
@DeadMG personal experience with smalltalk
 
maybe you should give a feature smalltalk has that C++ doesn't, or something like that
 
sbi
@KamilTomšík You know, C++ might suck at OO when compared to Smalltalk, and it might suck at Functional Programming when compared to LISP, it might also suck at Structured Programming compared to whatever... But the fact is that C++ sucks pretty well at a lot of things.
 
Anytime @MartinhoFernandes, anytime. :)
 
9:44 PM
C++ is the only language that will let you do OO and FP and etc
 
Xeo
C++ hater in a C++ chatroom....
 
sbi
@Xeo Yeah, and you kids all fell for him and discussed. How disgusting.
 
Xeo
No, I never even referenced him/them.
 
@sbi - Feel proud, eh?
 
Xeo
I only answered @DeadMG
 
9:46 PM
hey
I was late to the party and didn't quite cotton on fast enough
 
Xeo
@DeadMG Should that be "caught on"?
 
no
 
Xeo
Ah, I didn't know that saying
 
caught -> cotton is a pretty large variance
 
sbi
@Xeo In fact, I still don't.
 
9:48 PM
@DeadMG it's not about c++ having less features, it's about having more features - ironically, restricting all data as private and all methods as public in smalltalk, results in much better oo code... no multiple inheritance, also enforces composition.
 
Xeo
@sbi "schnallen, kapieren" is what dict.cc tells me
@KamilTomšík What, no private methods? Oh boy
 
@Kamil: That might be more "pure", but it's a crappy implementation
 
sbi
@Xeo Ah. dict.leo.org/?lp=ende&search=cotton. I hadn't even thought of looking this up as a verb. Thanks.
 
I'm the programmer, I say what is most appropriate for my situation, and if that's public data, then the language should shut up and do as I say
 
You guys look so weird talking to nobody.
21 mins ago, by DeadMG
but C++ with no macros, no templates, maybe no inheritance
 
Xeo
9:51 PM
@MartinhoFernandes Ignorant boy. :P
 
@Martinho: Only because templates and inheritance I was going to re-implement, and macros screw up everything else :P
 
I'm not going to flame about that, it's consistent, it's dumb-easy, it just works. If you need private method, you actually want public method somewhere else...
 
Xeo
Screw the preprocessor and give templates the ability to change syntax.
 
sbi
@Xeo Contrary to popular believe, ignoring is not the same as ignorant.
 
Xeo
@sbi I know I know. :P
But it fitted so well
 
9:52 PM
@DeadMG then you're not doing oop :)
 
@Kamil: I don't care what some language professor defines as OOP
 
Xeo
@KamilTomšík Oh yeah? I'm sure no.
 
OOP is the power for me to do what I want, nothing more and nothing less
 
guys... have anyone of you EVER programmed for while in smalltalk?
 
I don't see how that's contrary to what I just said
 
sbi
9:54 PM
@KamilTomšík So? If it gets the job done better, why would I care whether it conforms to a dead-tree definition of a paradigm? C++ shines best anyway where you mix and combine paradigms.
 
you've asked why c++ sucks at oo, that's why, I'm not complaining about effectiveness!
 
no, no
 
oo is not the best choice for everything.
 
Xeo
Whatever, I need to catch my train so I gotta go, see ya guys tomorrow.
Also, an upvote on any answer would be nice, I need to hit my hardcap today. </repwhoring>
 
if C++ sucks at OOP, then that implies that it's ineffective
 
sbi
9:55 PM
@KamilTomšík I started out with BASIC, learned Assembler, Pascal, Ada, C, some PROLOG, LISP, FORTRAN, COBOL, and C++. Nope, no Smalltalk. So?
 
but it isn't ineffective
@sbi: BASIC to Lua to C to C++, with a little Haskell, PROLOG, Java, JavaScript, PHP, C# thrown in, and a tiny bit of those not-really-languages like HTML and CSS
 
sbi
@DeadMG Oh yeah, I forgot C#. There must be a reason I forgot... What was I talking about?
 
lol
object orientatiom
 
user379888
C++ does not suck at OOP it provides something more powerful then most of the Object Oriented Languages
 
Xeo
@DeadMG C from book to C++ from Book to C++ to TMP. ;) A bit Lua maybe for game scripts.
 
9:57 PM
Why do you feed the trolls
 
honestly
 
Xeo
I sure didn't have a wide range of languages oO
 
a lot of people accuse me of never trying anything different
 
Xeo
I maybe need to take a look at something else
 
sbi
@Raynos Because then they grow and start to dominate the room?
 
Xeo
9:58 PM
Oh yeah, and C# recently
 
lol
 
sbi
@JustAnotherProgrammer That being non-OOP paradigms? :)
 
Xeo
I really ought to take a look at Python.
 
sbi
@Xeo Oh, do we now consider TMP a language of its own? :-o
 
please, re-read what I've said - from start...
 
Xeo
9:58 PM
@sbi Sure. :)
 
user379888
@sbi: Yes. You can use C++ almost everywhere
 
@sbi you sure you meant to address me with that?
@sbi: Yes.
I think it's a bit like a DSL
 
C++ is the DSL embedded in TMP.
Damn flaky network connection.
 
sbi
@DeadMG No, I didn't. The problem is that you need to click on a running target with your mouse to precisely reply to a message here, and not having a mouse with me I sometimes fail when the messages scroll passed too fast. Sorry.
 
user379888
Martinho Fernandes: I am again stuck with my code. I followed your advice but still it pritns out dashes.
 
Xeo
10:01 PM
So, finally gone. o/
 
user379888
#include <iostream>
#include <string>
#include <fstream>
using namespace std;
class Record
{
private:
	string name;
	string rollNo;
public:
	string getName();
	string getRollNo();
	void putData();
	void setData();
};
void Record::setData()
{
	cout << endl << "Enter Name:";
	cin.ignore();
	getline(cin,name,'$');
	cout << endl << "Enter Roll No:";
	cin.ignore();
	getline(cin,rollNo,'$');
}
void Record::putData()
{
	cout << endl << "Name:"<<getName();;
	cout << endl << "Roll No:"<<getRollNo();
}
string Record::getName()
 
Please don't post the code here in the room.
 
user379888
Sorry
 
user379888
I know its disturbing :'(
 
Use ideone.com or pastie or pastebin or something.
Also have a look at the file you wrote with some text editor. Make sure it contains what you expect.
 
sbi
10:03 PM
@JustAnotherProgrammer Please read the newbie hints linked in bold from the right panel. Among other things it talks about when to (not to) post code and questions here.
 
user379888
@sbi: Sorry for that
 
user379888
@MartinhoFernandes:ideone.com/XUlis
 
@sbi: btw, not sure if you're already aware, but there's (at least) a typo in the hints.
Jun 25 at 20:43, by sbi
Messages are one-liners by default and max. 500 characterss long. You can add a newline by pressing Shift+Enter; such messages have no max length (that that any of us has run up against). Note that messages with too many lines (according to a definition unknown to us) will be truncated by default, requiring users to click on an "expand" link to see them in full.
characterss
 
user379888
LOL
 
sbi
@MartinhoFernandes I just failed to see that again. :)
 
user379888
10:05 PM
That proves how many people have actually read it carefully ;)
 
sbi
@JustAnotherProgrammer Just a few days ago I posted those here, whereupon @Tomalak and one or two others pointed out numerous typos and other flaws, which I fixed. Then I posted again, and that became the version you now see. I can't believe there's still errors in that.
 
user379888
@sbi: I meant that it must have not been read by people :)
 
sbi
@JustAnotherProgrammer What does that imply about @Tomalak?
 
Come on, what's all this hatred towards @Tomalak?
 
user379888
@sbi: I was pointing towards ALL the people who have ever come to this room.
 
sbi
10:10 PM
Jun 29 at 14:20, by sbi
@hexa That's not true. I like @Tomalak. That doesn't mean we can't have a row, or I wouldn't flag him if he was rude, though.
 
user379888
@MartinhoFernandes: Can you please help me out with my code?
 
@sbi Was talking about @JustAnotherProgrammer's mention of "not read by people" not you.
@JustAnotherProgrammer Did you look at the file, to confirm it has the right content?
 
sbi
@JustAnotherProgrammer Well, most of the regulars understandably won't read the newbie hints. (Some, however did, and quite thoroughly, too.) That leaves the newbies to spot those flaws. Count you in on this group which failed. :)
 
@DeadMG smalltalk OO is simply less verbose then C++ OO
 
sbi
@MartinhoFernandes I didn't even consider he might know @Tomalak.
 
10:12 PM
@DeadMG I thought that was commonLISP
 
user379888
@MartinhoFernandes: The file has catenated the last word hundreds of times.
 
sbi
@Raynos If terseness was a criterion, how could Java ever be considered "more OO than C++"?
 
@DeadMG Oh cmon, You mean "meta Programming is the power for me to do what I want" please don't abuse the phrase OOP.
@sbi never said that. Java has a shit OOP system imho.
@sbi C++ has always been four languages, TMP, C, OOP C++ and STD.
 
user379888
@sbi: I am sorry, I agree. BTW its written beautifully. Remind me of coding horror :)
 
@JustAnotherProgrammer 1) you forgot a newline after writing the second string. 2) Use this loop to write the lines out: while(getline(file,str)) cout << str;.
 
10:18 PM
Is it poor ettiquite to come in and read up / comment on a conversation?
I feel like I'm forking a 1 hour old conversation and trying to respark it or something.
 
@Raynos I just came in to say that it would make it harder to actually have conversations
 
user379888
@Raynos: You are welcome
 
@LucDanton I guess it's harder if there are multiple conversations going on and if they are not in chronological order
 
user379888
@Raynos: I agree, people should create a new room if they want to chat specifically on some topic and it actually does happen many times
 
Well it's not that. I wanted to join in on the conversation, the conversation just ended before I arrived.
 
user379888
10:22 PM
Its never too late to mend :P
 
1 hour old?
8 hours ago, by Cat Plus Plus
PHP sucks.
It all started 8 hours ago.
And then died.
 
Well it was resparked with the flagged message :)
 
And came back from the ashes.
And then died.
 
The second one was more an attack on C++
 
And now seems like it was coming back again.
 
user379888
10:24 PM
No one uses such words about PHP infront of me :P
 
Can we attack a idfferent community?
I have a genuine question though
 
1) It was in the wrong place 2) He shouldn't post that
 
Why is C++ incredibly popular in the game development sector?
 
And I'm getting a bit tired of these language "wars".
 
@Martin
 
user379888
10:26 PM
@Raynos: Maybe because OpenGl libraries and everyone started to develop games on C++ and now it rich with it?
 
but cant we write in any old high level language that can talk to the C++ APIs ?
 
Well, that's what scripting languages are used for
and that's a legitimate use of 'scripting language' here ;)
 
But why don't we use higher level languages for anything non critical.
generally isn't the GPU the main bottle neck? Do games use more CPU then I realise?
 
I don't know. Because C++ can do that job as well, and since you're already using C++ and people that know C++, perhaps.
 
Do you find development time in C++ is as fast as some high level language ?
 
10:29 PM
Yes.
 
Ah, that's different then.
 
user379888
That's maybe because much development has been done in it
 
I always imagine that C/C++ development takes 2-3x as long as python / <insert scripting language>
 
user379888
It has easy to develop games in it
 
@Raynos C is not C++.
If you said that about C, I'd probably agree.
 
10:30 PM
I wished you had a precise meaning for 'high level language' here since C++ is high level: something domain specific?
 
@Raynos How long have you been using C++?
 
@fireshadow52 I've been avoiding C++
 
Jez
Hi everyone, anyone here use Debian?
 
I've used C for a few months.
 
Are they similar? I haven't used C, only C++
 
10:31 PM
@LucDanton C++ is high level, I don't really know where I'm going with this.
@fireshadow52 Apararently C and C++ are not as similar as I though
 
They share syntax.
 
@LucDanton I probably mean a dynamic scripting language.
 
And the C stdlib.
 
Is C++ a strict superset of C?
 
Which you won't likely use in C++.
 
10:32 PM
@MartinhoFernandes Oh ok.
 
@Raynos Close.
 
There are valid C programs that are not valid C++.
 
It's close to being a superset of C89, but not of C99
 
Are those valid C programs obscure hackish edge cases?
 
10:33 PM
Nah, it's really easy to get one.
int* c = malloc(10*sizeof(int));
 
Is it genuine accepted opinion that C++ development is just as fast as developing in scripting languages ?
 
Jez
Well if you are interested there's a new Area51 Debian proposal, could be useful to you guys at some point:
1
Debian

Proposed Q&A site for debian users and developers.

Currently in definition.

 
Sorry to interrupt but how do you post code in the chat?
 
@Jez why do you keep spamming us about Area51 sites?
 
I personally find C# and Java development slower, don't know whether I can apply the same analogy to C++
 
10:35 PM
Is someone paying you?
 
Jez
i'm informing you about that in which you might be interested
 
@fireshadow52 It's in the newbie hints and the FAQ.
 
@Raynos That's a subjective issue. I personally find that dynamic languages slow me down.
 
@MartinhoFernandes I didn't actually know that.
 
10:38 PM
If you wanna know, when I said above I find development in C++ as fast as other high-level languages, I was comparing it to C#, which I've used extensively in the past.
 
I can imagine C# being as fast to develop as C++
I actually meant dynamic / functional languages.
 
Well, like I said, I don't work very well with dynamics. I do like almost-exclusively-functional languages though, but they're not very popular, so I haven't used them much.
I used Haskell for three or four years in college.
 
user379888
I have used both C and C++ and love them.
 
user379888
I started from BASIC
 
@JustAnotherProgrammer anything is better then BASIC :p
 
user379888
10:44 PM
@Raynos: Agree, but it helped me think how softwares run :)
 
C does that as well
If you havn't had the chance I would recommend putting a functional language on your to-learn list.
 
user379888
Yes but I was forced to learn it. It was a part of my syllabus :P
 
user379888
i have actually never done anything useful with programming. Have built nothing more than unreal applications with C/C++
 
@Raynos Just curious, what do you consider a functional language?
 
Anything with first class functions is good enough
 
10:47 PM
So, he's already learning one :)
 
Although if I recommend a FP language I would recommend erlang / haskell
@MartinhoFernandes function pointers are not first class functions ¬_¬
 
@Raynos What are first class functions?
 
functions you can pass by reference && not pointers
 
user379888
You mean where the smallest unit is a function
 
I like arbitary definitions you can't argue againts :P
 
10:49 PM
@Raynos Sounds like it.
 
user379888
:p
 
I genuinely don't know whether function pointers count
But they do feel cheating.
The main criteria for why function pointers fail is the lack of closures
So let's redefine it to "any language with closures"
 
C++11 is getting closures.
 
Pointers have nothing to do with FP, plus you can pass functions by reference in C++
 
Then I'll accept C++ <strike> is functional </strike> allows you to write in a functional paradigm
 
user379888
10:50 PM
how do you all get such good reputation?
 
Helping others.
 
@JustAnotherProgrammer JavaScript.
Easiest rep ever.
 
user379888
@Raynos: 19 K (O.o)
 
'First class functions' is usually used for things like treating functions like any other types, so e.g. can have variables of function type, return functions, and so on.
So C++11 is getting there yes.
Still needs local/nested functions though.
 
if you guys talk about C++11 is C++0x "out"
 
10:52 PM
It needs some rubber stamping.
 
There's the FDIS which is the next best thing to an international Standard
 
Is it? Since the FDIS is out I think it's a bit further from that
e.g. I'd think the vote is closed
Nevermind me I can't make heads or tails of the process
 
> Target publication date: 2012-02-28
:(
 
11:19 PM
so, php is cool rite?
 
@hexa yes
 
anyway, its so embarrassing. I don't know how to use ifstream properly. I ran through the stream with getline(), now I wanna rewind it (seekg(o, ios::beg) and get the words with while (in >> string)... but i get nothing. please instruct this newb here
 
@hexa if thats a php question go ask PHP
 
it isn't dude.
 
user379888
0
Q: ASCII character appending multiple times in file.

JustAnotherProgrammerI am working on a project in which I have to read and write string to a file. I am having a strange problem that after taking input some characters are itself appended to the file and when I display its content, the data stored does not get displayed but the screen gets filled with = signs. Here ...

 
11:25 PM
@hexa I don't know why it's not working after rewinding. But you don't need to go through the file again to get the words if you already have the lines.
 
I am aware of this. It has no practical use but to teach me the STL, streams and so on
 
You can use an ostringstream for that.
WTF did I just say? That makes no sense.
@hexa Is that a letter o in seekg or a number zero?
 
0
 

« first day (261 days earlier)      last day (4679 days later) »