Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Nov 20, 2012, 02:16 PM   #1
stevegreen22
macrumors newbie
 
Join Date: Aug 2012
Bizarre issue!!!

Hey guys.

Can someone perhaps help explain this issue I'm having?

Essentially I get an error whenever I add an endl or a out stream to another.

For example:

Code:
      cout << ac.getSizeOfCollection();
Works fine but....
Code:
      cout << ac.getSizeOfCollection() << " Size" <<endl;
Doesn't

I have the same issue with this:

Code:
            cout << "fdsddigifg " << meh.getNumberOfTracks();
//
Works fine but the one below doesn't
Code:
            cout << "fdsddigifg " << meh.getNumberOfTracks() <<" Tracks"<<endl;
//
Any ideas or suggestions? I've tried to trace back the outstream as it's overloaded and every step of the way it's fine. I simply don't understand it. -.-
stevegreen22 is offline   0 Reply With Quote
Old Nov 20, 2012, 04:38 PM   #2
gnasher729
macrumors G5
 
gnasher729's Avatar
 
Join Date: Nov 2005
Quote:
Originally Posted by stevegreen22 View Post
Hey guys.

Can someone perhaps help explain this issue I'm having?

Essentially I get an error whenever I add an endl or a out stream to another.

For example:

Code:
      cout << ac.getSizeOfCollection();
Works fine but....
Code:
      cout << ac.getSizeOfCollection() << " Size" <<endl;
Doesn't

I have the same issue with this:

Code:
            cout << "fdsddigifg " << meh.getNumberOfTracks();
//
Works fine but the one below doesn't
Code:
            cout << "fdsddigifg " << meh.getNumberOfTracks() <<" Tracks"<<endl;
//
Any ideas or suggestions? I've tried to trace back the outstream as it's overloaded and every step of the way it's fine. I simply don't understand it. -.-
Try if std::endl makes a difference. Because std::endl is the end of line marker, and endl could be anything. If you added a variable "int endl;" at the beginning of a function that would produce some rather funny results. BTW. Once your programs get larger, you will very much prefer std::cout to cout because it provides a lot more information when you read code.
gnasher729 is offline   0 Reply With Quote
Old Nov 20, 2012, 06:02 PM   #3
lloyddean
macrumors 6502a
 
Join Date: May 2009
Location: Des Moines, WA
Odds are 'meh.getNumberOfTracks()' is not returning an 'stream&' so there is no stream for 'endl' to do it's thing against.
lloyddean is offline   0 Reply With Quote
Old Nov 21, 2012, 12:05 AM   #4
MattMcClinch
macrumors newbie
 
Join Date: Jan 2008
Quote:
Originally Posted by lloyddean View Post
Odds are 'meh.getNumberOfTracks()' is not returning an 'stream&' so there is no stream for 'endl' to do it's thing against.
'meh.getNumberOfTracks()' doesn't need to return a stream&.
'cout << "fdsddigifg " << meh.getNumberOfTracks()' should return a stream&.
'meh.getNumberOfTracks()' should return a nonnegative integer.
MattMcClinch is offline   0 Reply With Quote
Old Nov 21, 2012, 12:43 AM   #5
lloyddean
macrumors 6502a
 
Join Date: May 2009
Location: Des Moines, WA
You're correct! Which is why one should never respond under the effect of pain.

Thanks for catching that.
lloyddean is offline   0 Reply With Quote
Old Nov 21, 2012, 12:51 AM   #6
lee1210
macrumors 68040
 
lee1210's Avatar
 
Join Date: Jan 2005
Location: Dallas, TX
We don't have enough info. meh.GetNumberOfTracks()... What does it return? Did you write the operator<< method to handle this? How about ac.getSizeOfCollection? Can you output ANYTHING after one of these? Is the problem just endl? What is the problem? A compiler error? What is it? A runtime error? Incorrect results?

-Lee
lee1210 is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
Bizarre Photoshop Screen Issue Phrasikleia Digital Photography 5 Feb 10, 2014 08:54 PM
Disaster! Outlook 2011 major (bizarre) issue! austincolby Mac Applications and Mac App Store 11 Aug 15, 2013 01:40 PM
Bizarre download throttling issue. Mac OS related or wireless network related? Jottle Mac OS X Server, Xserve, and Networking 9 Jul 22, 2013 01:30 PM
Resolved: 2008 24" iMac Bizarre freezing issue Twimfy iMac 23 Mar 4, 2013 12:06 PM
2011 MB Air 11" - turns ON when shut down and close lid - BIZARRE ISSUE joecool99 MacBook Air 4 Sep 9, 2012 03:17 PM

Forum Jump

All times are GMT -5. The time now is 06:56 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC