C Board  

Go Back   C Board > Platform Specific Boards > Linux Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 02-12-2002, 02:41 PM   #1
Registered User
 
Join Date: Feb 2002
Posts: 26
syntax

What are the major differences of the linux syntax in comparision to windows syntax while programming?
ghe1 is offline   Reply With Quote
Old 02-12-2002, 10:36 PM   #2
Registered User
 
Join Date: Aug 2001
Posts: 202
In Java, and Perl, very little.

In C, maybe nothing, maybe a lot, it depends on what you're trying to do. By an large the differences come when you use libraries that are unique to a certain operating system.

If you gave me a better idea of what you're trying to do, I can give you a more definite answer,

starX
www.axisoftime.com
starX is offline   Reply With Quote
Old 02-13-2002, 08:23 AM   #3
Registered User
 
Join Date: Feb 2002
Posts: 26
My situation is this: I have a c program that determines the free disk space on a drive. Within this code, I need to add a function that is called before the rest of the code executes to determine whether or not I am in a windows environment or in a linux environment. I also have code for the unix side, "statvfs" that determines the disk space.
ghe1 is offline   Reply With Quote
Old 02-13-2002, 01:30 PM   #4
and the hat of Jobseeking
 
Salem's Avatar
 
Join Date: Aug 2001
Location: The edge of the known universe
Posts: 21,710
> to determine whether or not I am in a windows environment or in a linux environment.
No such function exists

You need to compile the code with conditional compilation directives, like so

Code:
#ifdef LINUX
space = statvfs();
#elif WINDOWS
space = GetDiskFreeSpace();  // or whatever
#else
#error Not LINUX or WINDOWS
#endif
Then you compile it for LINUX using
gcc -DLINUX prog.c

and for windows
cl -DWINDOWS prog.c
Salem is offline   Reply With Quote
Old 02-13-2002, 01:53 PM   #5
Registered User
 
Join Date: Feb 2002
Posts: 26
Thanks for the advice. That is what I have been needing!
ghe1 is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
more then 100errors in header hallo007 Windows Programming 20 05-13-2007 08:26 AM
We Got _DEBUG Errors Tonto Windows Programming 5 12-22-2006 05:45 PM
Using VC Toolkit 2003 Noobwaker Windows Programming 8 03-13-2006 07:33 AM
Connecting to a mysql server and querying problem Diod C++ Programming 8 02-13-2006 10:33 AM
Dikumud maxorator C++ Programming 1 10-01-2005 06:39 AM


All times are GMT -6. The time now is 09:24 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22