Portál AbcLinuxu, 12. května 2025 05:19
#include <hlavickovy_soubor.h>
Protože zastávám názor, že lidi by se měli naučit hledat, než položí takovýhle dotaz, neřeknu ti, jaký hlavičkový soubor potřebuješ - buď si to najdi, nebo počkej, někdo jiný se nad tebou třeba slituje. (Krom toho to na 80% bude napsáno tam, kde jsi našel ten kus kódu)
termios.h
ve kterem by to melo byt tak to hlasi ze to tam neni. Zkousel jste to nekdo prelozit kdyz tak dobre radite? Nekde jsem nasel ze v novejsich jadrech to cele predelali ale nenasel jsem jak
#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 */
#include <sys/ioctls.h>
int main(void)
{
int fd; /* File descriptor for the port */
int status;
fd = open("/dev/tts/USB0", O_RDWR | O_NOCTTY | O_NDELAY);
if (fd == -1)
{
perror("open_port: Unable to open /dev/ttyS0 - ");
}
else{
ioctl(fd, TIOCMGET, &status);
status &= ~TIOCM_DTR;
ioctl(fd, TIOCMSET, status);
fcntl(fd, F_SETFL, 0);
}
return (fd);
}
omlouvam se za formatovani trosku se to rozjeloTo nemusíš, stačí, když se naučíš číst
...kdyz pripojim hlavickovy soubor termios.h ve kterem by to melo byt tak to hlasi ze to tam neni.Tam to být nemá. Zkus místo sys/ioctls.h použít sys/ioctl.h
Tiskni
Sdílej:
ISSN 1214-1267, (c) 1999-2007 Stickfish s.r.o.