.com.unity Forums

.com.unity Forums (http://forum.shrapnelgames.com/index.php)
-   Space Empires: IV & V (http://forum.shrapnelgames.com/forumdisplay.php?f=20)
-   -   Coding Inquiry (http://forum.shrapnelgames.com/showthread.php?t=11800)

Cipher7071 April 5th, 2004 10:06 PM

Re: Coding Inquiry
 
I guess I don't quite understand the distinction. Or have I been using too much Pascal?

Will April 5th, 2004 10:17 PM

Re: Coding Inquiry
 
IIRC, chop() is a perl function.

The confusion arises in C/C++ with strings because the name "string" is often used interchangably for the C++ class string, and the "C-style" pointer to an array of characters. And there is quite a bit of difference between an object and a char* http://forum.shrapnelgames.com/images/icons/icon7.gif

AFAIK, internally, the C++ class string really is just a sort of character array, only with seperate classes for characters to deal with unicode and all that. I remember the first time I saw what "string" actually represents in the debugger, something like three nested templated classes... I was confused for about 10 minutes as to why the function it said was behaving badly was taking that monster as an argument instead of the innocent "string" type I had it taking. But, for most people, as long as you know those functions, you can leave all the nasty bits (such as converting the object to an array of dynamically allocated characters) to the class, and go on your merry way http://forum.shrapnelgames.com/images/icons/icon7.gif

Ed Kolis April 6th, 2004 03:07 AM

Re: Coding Inquiry
 
Or use C#, where string is a predefined data type http://forum.shrapnelgames.com/images/icons/icon10.gif

Fyron April 6th, 2004 04:10 AM

Re: Coding Inquiry
 
c_str() did the trick. Thanks!

Fyron April 6th, 2004 04:25 AM

Re: Coding Inquiry
 
New question: How do I access files in other directories with file streams?

Atrocities April 6th, 2004 05:39 AM

Re: Coding Inquiry
 
Quote:

Originally posted by Imperator Fyron:
</font><blockquote><font size="1" face="sans-serif, arial, verdana">quote:</font><hr /><font size="2" face="sans-serif, arial, verdana">Originally posted by Atrocities:
If you want to write a program, write one that automatically breaks the files down into easy to follow and PRINTABLE tech trees for use with mods.

<font size="2" face="sans-serif, arial, verdana">That would be rather hard to do... if each tech only had one level, it would be easy. But with lots of levels, it becomes messey... :-\ </font><hr /></blockquote><font size="2" face="sans-serif, arial, verdana">Well if any one can do it I am sure you can. http://forum.shrapnelgames.com/images/icons/icon7.gif

Will April 6th, 2004 06:08 AM

Re: Coding Inquiry
 
Both Windows and Unix use the convention of . for the current directory, and .. for the previous directory. So, you can access directories relatively (eg. "..\..\SEIV\Data\component.txt") or absolutely (eg. "C:\Program Files\Shrapnel\SE4Gold\Data\component.txt").


All times are GMT -4. The time now is 02:10 AM.

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©1999 - 2025, Shrapnel Games, Inc. - All Rights Reserved.