GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Tue Oct 21, 2014 8:50 am

All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: How to get absolute path in GTK- C
PostPosted: Mon Jul 03, 2006 5:34 am 
Offline
Familiar Face

Joined: Wed Jun 28, 2006 5:10 am
Posts: 8
Hi all
How to get an absolute path of an file in GTK.

Thanks in advance.

Iswaria.


Top
 Profile  
 
 Post subject: Code to find the absolute path of the current directory
PostPosted: Mon Jul 03, 2006 8:49 am 
Offline
Familiar Face

Joined: Wed Jun 28, 2006 5:10 am
Posts: 8
Hi

Code to find the absolute path of the current directory

--------------------------------------------------------------------
#include <stdio.h>

int main() {
FILE *in;
extern FILE *popen();
char buff[512];

/* popen creates a pipe so we can read the output
of the program we are invoking */
if (!(in = popen("pwd", "r"))) {
exit(1);
}

/* read the output of netstat, one line at a time */
while (fgets(buff, sizeof(buff), in) != NULL ) {
printf("Output: %s", buff);
}

/* close the pipe */
pclose(in);
}

--------------------------------------------------------------------

Regards
Iswaria.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 03, 2006 5:42 pm 
Offline
Never Seen the Sunlight

Joined: Wed Sep 21, 2005 12:07 am
Posts: 563
Location: Portland, OR USA
You can also use standard GNU C functions such as getwd and getcwd as described at http://www.gnu.org/software/libc/manual/html_node/Working-Directory.html

_________________
Micah Carrick - Forum Administrator
http://www.micahcarrick.com


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group