View previous topic :: View next topic |
Author |
Message |
usanet21 n00b
Joined: 20 Feb 2003 Posts: 24
|
Posted: Mon Mar 24, 2003 4:45 am Post subject: how to search for header files |
|
|
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 |
|
|
count Apprentice
Joined: 28 May 2002 Posts: 242 Location: Dalton, MA
|
Posted: Mon Mar 24, 2003 4:50 am Post subject: |
|
|
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 |
|
|
usanet21 n00b
Joined: 20 Feb 2003 Posts: 24
|
Posted: Mon Mar 24, 2003 5:16 am Post subject: Serial connection codes. |
|
|
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 |
|
|
count Apprentice
Joined: 28 May 2002 Posts: 242 Location: Dalton, MA
|
Posted: Mon Mar 24, 2003 5:21 am Post subject: |
|
|
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 |
|
|
usanet21 n00b
Joined: 20 Feb 2003 Posts: 24
|
Posted: Mon Mar 24, 2003 5:43 am Post subject: Glade and serial connection |
|
|
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 |
|
|
count Apprentice
Joined: 28 May 2002 Posts: 242 Location: Dalton, MA
|
Posted: Mon Mar 24, 2003 2:13 pm Post subject: |
|
|
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 |
|
|
|