LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 12-17-2010, 10:29 AM   #16
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443

Original Poster
Blog Entries: 3

Rep: Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723

What I'm talking about is if there's a macro that's defined only if GNU libc is used, so if not, I can just use standard functions.

Code:
	int linesize = BUFSIZ;
	char* line = malloc(linesize * sizeof(char));
#ifdef glibc
	while (getline(&line, &linesize, file))
#else
	while (fgets(line, linesize, file))
#endif
	{
		// do stuff
	}
	free(line);
 
Old 12-17-2010, 11:24 AM   #17
tronayne
Senior Member
 
Registered: Oct 2003
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,541

Rep: Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065
There is a macro or variable or something that is defined -- I just can't remember the name of it (it's got a leading and trailing two underscores, like this __variable__). I've been digging around in some configure files that support multiple platforms (figure out what you're running on, what compiler you've got and the like) and darned if I can find where and how that's done.

Sorry, no luck -- maybe somebody else will know.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Reading the Versados file format saintt Linux - General 6 02-22-2010 08:41 AM
[SOLVED] Simple Linux script to convert datetime format to UTC format shayno90 Linux - Newbie 10 10-09-2009 08:19 AM
wk1 format reading in c leonidg Programming 2 02-23-2005 01:27 PM
Helix-Server, Quicktime, and some simple file format converters Conpen2000 Linux - Software 1 08-27-2004 10:42 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:13 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration