Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using GNU C Libraries and other Data structure libraries on Mac/Windows/Linux.?

I want to know if the C libraries system/string/data structure/data base etc are platform dependent.?

what are the things of these libraries that are dependent on a specific platform.? like how a regular expression/string manipulation/sql connectivity etc libraries are dependent on a platform.?

can I use them on any platform for File I/O/Paths etc just like we do things in python using the sys/os etc modules.?

I want to build a program which deals with strings,database(sqlite3,mysql,Oracle),data structures,File I/O and System paths. and can run on Windows,Linux and Mac when re compiled on that platform. and I want it to be console based.

Please don't recommend me to do it in other programming languages, I want the C folks to answer please.

Thanks

like image 677
CuCu Avatar asked Apr 20 '26 04:04

CuCu


1 Answers

Well, as long as you use the standard C library, all is well. The GNU C Library (glibc) is one implementation of the C standard, and for example Microsoft has their own implementation of it.

From a user's (your) perspective, the impelementation doesn't matter. If you for example

#include <stdio.h>

then you can, on any standards-compliant platform, call the fopen() and then use fread() for file i/o. Or any other standard C function.

Linux, Mac and Windows are all standards compliant (i.e. have implemented the ISO C) and thus the standard functions do the same thing on all platforms. The filepaths that you pass to fopen() are the same, too. The fact that Windows uses backslash ( \ ) in the filepath instead of the Unix way (forward slash, / ) doesn't matter: on Windows, in your C program, you use the Unix-style notation.

like image 154
Razbit Avatar answered Apr 22 '26 20:04

Razbit



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!