Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
how to search for header files
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
usanet21
n00b
n00b


Joined: 20 Feb 2003
Posts: 24

PostPosted: Mon Mar 24, 2003 4:45 am    Post subject: how to search for header files Reply with quote

hi, just wanna ask how to i search for header files in linux
What i mean is like lets say i want to know where <termios.h> is located, how do i serach for??
Back to top
View user's profile Send private message
count
Apprentice
Apprentice


Joined: 28 May 2002
Posts: 242
Location: Dalton, MA

PostPosted: Mon Mar 24, 2003 4:50 am    Post subject: Reply with quote

Code:
slocate termios.h
you can use the command 'locate' instead of 'slocate' if you dont have sys-apps/slocate (you will know if you get a command not found)
_________________
- Joseph Monti
_________________
This message is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation. For more info visit http://joemonti.org/
Back to top
View user's profile Send private message
usanet21
n00b
n00b


Joined: 20 Feb 2003
Posts: 24

PostPosted: Mon Mar 24, 2003 5:16 am    Post subject: Serial connection codes. Reply with quote

hi, does anyone knows how to include this junk of code into GLADE??
i just need to know how to include it together.

Listing 1 - Opening a serial port.

#include <stdio.h> /* Standard input/output definitions */
#include <string.h> /* String function definitions */
#include <unistd.h> /* UNIX standard function definitions */
#include <fcntl.h> /* File control definitions */
#include <errno.h> /* Error number definitions */
#include <termios.h> /* POSIX terminal control definitions */

/*
* 'open_port()' - Open serial port 1.
*
* Returns the file descriptor on success or -1 on error.
*/

int
open_port(void)
{
int fd; /* File descriptor for the port */


fd = open("/dev/ttyS0", O_RDWR | O_NOCTTY | O_NDELAY);
if (fd == -1)
{
/*
* Could not open the port.
*/

perror("open_port: Unable to open /dev/ttyS0 - ");
}
else
fcntl(fd, F_SETFL, 0);

return (fd);
}
Back to top
View user's profile Send private message
count
Apprentice
Apprentice


Joined: 28 May 2002
Posts: 242
Location: Dalton, MA

PostPosted: Mon Mar 24, 2003 5:21 am    Post subject: Reply with quote

Well, you dont actually code in Glade. It is just an interface designer.

Do you mean "does anyone know how to include this junk of code into Glade generated code?"
_________________
- Joseph Monti
_________________
This message is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation. For more info visit http://joemonti.org/
Back to top
View user's profile Send private message
usanet21
n00b
n00b


Joined: 20 Feb 2003
Posts: 24

PostPosted: Mon Mar 24, 2003 5:43 am    Post subject: Glade and serial connection Reply with quote

yeah thats right, what i meant was how to include this junk of code into Glade generated code?

The code had no error one..i copy it from a website. what error i had now is it says:
no previous prototype for 'open_port'
'fd' undeclared

i mean i checked everything already..can someone pls help...it would begretaly appreciated
Back to top
View user's profile Send private message
count
Apprentice
Apprentice


Joined: 28 May 2002
Posts: 242
Location: Dalton, MA

PostPosted: Mon Mar 24, 2003 2:13 pm    Post subject: Reply with quote

You can put that function in ${projectdir}/src/support.c and place the function prototype in ${projectdir}/src/support.h. This way you will be able to use the function pretty much anywhere in your GUI.

How you want to call the function open_port() really depends on where you want to do it.

Do you want it to happen when the application starts? or Do you want it to happen whan a button is pressed?

For when the application starts put it in ${projectdir}/src/main.c

For when a button is pressed you need to add a clicked signal to the button in Glade. All signal functions are put in ${projectdir}/src/callbacks.c.

Wherever you call the open_port() function you need to make sure you see #include "support.h", which will probably bee there.

Does this help?
_________________
- Joseph Monti
_________________
This message is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation. For more info visit http://joemonti.org/
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
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 vote in polls in this forum