Hi - I'm using the open() function to open an existing file on linux. I keep getting a failure return value (-1 in this case) when trying to do so:
int result = open("/tmp/my_file" , O_RDONLY);...
Type: Posts; User: sa125
Hi - I'm using the open() function to open an existing file on linux. I keep getting a failure return value (-1 in this case) when trying to do so:
int result = open("/tmp/my_file" , O_RDONLY);...
I have no idea how to do that.
I should have mentioned this was part of a larger function. fname is a const char of the file name passed into the function. I want to know its size so I can read it using read() function later. This...
Hi - I'd like to count the bytes in a file and a fifo (linux). What's the best way to do it? This is what I did so far and got 0 (for a file who's around 80 bytes):
FILE* f =...
Wow, and that kept me debugging for 4 hours. Thanks for your help!
I just realized I wrote I had 3 and 4 errors in the same post.. It's late here :)
The real number is 3, and they are:
reader.h: error: expected declaration specifiers or ‘...’ before...
MacGyver (love the 'nick) - I use eclipse on linux and compile (gcc) on every save, and I only see 4 errors that are all related to that same reader problem. So I'm not sure why you're getting more -...
And the rest.
Here are 5 more.
I can't upload more than 5 files. So here a the few that cause the issue. Thanks.
No... Didn't do the trick. Thanks though.
I'm writing a thread pool that will contain reader threads, and am having a problem with the reader struct that I can't figure out. Please see the screen shots of my header files. The error...
I tried that but it referenced the same item in memory for all nodes. So, in my tester.c file I inserted the string "node %d" for i = 0; i < 5, and got:
node 4
node 4
node 4
node 4
node 4
...
Attached is my code - I'm testing the queue in the tester.c function, where the seg fault happens. Thanks!
Hello - I've written a queue and I'm trying to keep it generic as far as the data it could hold. For that purpose, my node structure is defined as such:
struct node {
void* data;
struct...
Hi - I'm fairly new to C and just wrote a very simple generic queue. I wrote a small loop to test out my queue (add 1-5 to the queue and then print it), and it works fine. The problem is that I get a...