View Single Post
Re: I'm STEAMed up !!!
Old
  (#11)
Austin
Moderator
 
Austin's Avatar
 
Status: Offline
Posts: 403
Join Date: Nov 2003
Default Re: I'm STEAMed up !!! - 31-12-2003

Quote:
Originally Posted by Pierre-Marie Baty
w000H00H00H00H00000000t!!!!

// if you know a more orthodox way of doing this, please tell me.
// test file, if found = STEAM Linux/Win32 dedicated server
fp = fopen ("valve/steam.inf", "rb");
if (fp != NULL)
{
fclose (fp); // test was successful, close it
is_steam = mTRUE; // this file is typical from a STEAM DS install
}
A more orthodox way of testing if a file exists instead of trying to open it?
Sure:

#include <sys/stat.h>

struct _stat buf;
if( _stat( "valve/steam.inf", &buf ) == 0 )
{
//file exists
}




Quote:
Originally Posted by Pierre-Marie Baty
Hey thanks Austin

is it portable ?
Totally,
Standard c lib stuff.

Last edited by Austin; 01-01-2004 at 09:12..
  
Reply With Quote