![]() |
| | #1 | |
| Banned Join Date: May 2007 Location: Berkeley, CA
Posts: 329
| Issues compiling multiple c files. Code: [cdalten@localhost YAPP]$ more diren.h
#define MAX 14
typedef struct {
long ino;
char name[MAX + 1];
} Dirent;
typedef struct {
int fd;
Dirent d;
} DIR;
Code: [cdalten@localhost YAPP]$ more opendir.c
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include "diren.h"
#define PATH "/home/cdalten/oakland"
DIR *opendirectory(void) {
int fd;
DIR *dp;
if ( (fd = open(PATH, O_RDONLY)) < 0) {
perror(PATH);
exit(EXIT_FAILURE);
}
dp = (DIR *)malloc(sizeof(DIR));
dp->fd = fd;
return dp;
}
int main(void) {
size_t n;
char buf[BUFSIZ];
DIR *dfp;
dfp = opendirectory();
/*if ( (fd = open(PATH, O_RDONLY)) < 0) {
perror(PATH);
exit(EXIT_FAILURE);
}
while ((n = read(fd, buf, BUFSIZ)) > 0) {
if (write(1, buf, n) != n) {
fprintf(stderr, "Can't call write\n");
exit(EXIT_FAILURE);
}
}
close(fd);*/
exit(EXIT_SUCCESS);
}
[cdalten@localhost YAPP]$
Code: [cdalten@localhost YAPP]$ more readdir.c
#include <sys/dir.h>
#include "diren.h"
DIR *readdirectory() {
struct direct dirbuf;
static Dirent d;
}
[cdalten@localhost YAPP]$
Quote:
| |
| Overworked_PhD is offline | |
| | #2 |
| and the Hat of Guessing Join Date: Nov 2007
Posts: 10,163
| What are you doing wrong? Why are you redefining system names? |
| tabstop is offline | |
| | #3 |
| Banned Join Date: May 2007 Location: Berkeley, CA
Posts: 329
| I knew that. I really did. |
| Overworked_PhD is offline | |
![]() |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| header files and multiple files | Dedalus | C Programming | 5 | 06-16-2009 09:21 AM |
| Compiling Multiple files in a single Project | pdwivedi | C Programming | 2 | 10-08-2007 05:14 AM |
| Windows shell commands - multiple files | Magos | Tech Board | 3 | 02-28-2006 01:56 AM |
| Linker errors - Multiple Source files | nkhambal | C Programming | 3 | 04-24-2005 02:41 AM |
| Multiple files using RHIDE | Unregistered | C Programming | 3 | 10-05-2001 06:39 PM |