Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

BigPrince

macrumors 68020
Original poster
Dec 27, 2006
2,053
111
Hey, I just started learning C++. At school we use Visual Studio 2003. If I do thing in xCode, will things go smoothly if I try to open the code in Visual Studio? Anything special I need to do.
 

bousozoku

Moderator emeritus
Jun 25, 2002
16,120
2,397
Lard
You'll only have to pay attention to the line endings in the editor because VS 2003 could become confused.

Standard C++ will work in any compliant compiler, but often instructors will use DOS/Windows only methods to handle text-only programmes.
 

BigPrince

macrumors 68020
Original poster
Dec 27, 2006
2,053
111
I dont even know what line endings are.

I am basically starting out with messing with Arrays and filling them up with numbers from an input file, taking the average, sorting them, searching and what not. If I do try it in Xcode, I will let you know my sucess.
 

kainjow

Moderator emeritus
Jun 15, 2000
7,958
7
I dont even know what line endings are.

It's how a new line in a text file is represented (when you press Return/Enter on the keyboard?). On Mac OS X/*nix, it is represented with a 1-byte character, while on Windows it is 2 bytes, but a *smart* text editor will display them both the same.

Here is an example file: View attachment 66847 - If you load it in TextEdit on Mac OS X, it loads correctly. If you load it in NotePad on Windows, it won't, because NotePad doesn't read *nix-style line endings (WordPad does though). It's what makes Windows special :)
 

csubear

macrumors 6502a
Aug 22, 2003
613
0
Hey, I just started learning C++. At school we use Visual Studio 2003. If I do thing in xCode, will things go smoothly if I try to open the code in Visual Studio? Anything special I need to do.

Opening c++ files, yes.
Opening .vcproj, no, well it won't open a project or anything.

Last time I check Visual Studio's stl implementation does some non-standard stuff.
 

From Win to Mac

macrumors regular
Apr 25, 2001
172
79
Montreal, Canada
For now, you should be fine because you're doing basic stuff. As a general rule of thumb, anything in your C++ Beginner book will work on Windows, Mac, and Linux, unless otherwise noted.

But the moment you start doing anything more, like creating a user interface (with Windows Forms or MFC), start including windows specific libraries (using the "#include" command, like windows.h), or networking, it won't work.

You've just started though, so you should be fine. You have a lot of stuff to see before you venture in Windows libraries... Know what Object Oriented is ? :p
 

bousozoku

Moderator emeritus
Jun 25, 2002
16,120
2,397
Lard
It's how a new line in a text file is represented (when you press Return/Enter on the keyboard?). On Mac OS X/*nix, it is represented with a 1-byte character, while on Windows it is 2 bytes, but a *smart* text editor will display them both the same.

Here is an example file: View attachment 66847 - If you load it in TextEdit on Mac OS X, it loads correctly. If you load it in NotePad on Windows, it won't, because NotePad doesn't read *nix-style line endings (WordPad does though). It's what makes Windows special :)

To make it more fun, Mac OS 9 and earlier used a different character.
 

Palad1

macrumors 6502a
Feb 24, 2004
647
0
London, UK
If you start doing ATL / MFC or even Win32 user interfaces, you're stuck though.

Your only option would be to use a cross-platform third-party GUI tookit such as wxWidgets but doubt your MFC prof. would be happy to learn wxWidgets just for you.

Good luck!
 

pilotError

macrumors 68020
Apr 12, 2006
2,237
4
Long Island
As far as conversion, You can use FTP in text mode. If available. I think wordpad allows you to save as DOS text.

When FTP'ing (or cut/paste) from the PC, just do a dos2unix on the text file.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.