Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

fopen says file does not exist

Name: Anonymous 2010-09-27 19:38

I'm trying to make a call to fopen in C, but it says the file doesn't exist. Except it does. The file gets created during execution and I have verified that it does, in fact, get created (and it does contain what I want it to). I chmodded the file and its parent directory to 755 but that didn't help anything. Here's the code.

// wc -l ~/server/.tmp | sed 's/ .*//g' > ~/server/.wc
// line count --> erase the filename --> store in file .wc
if ((system("wc -l ~/server/.tmp | sed 's/ .*//g' > ~/server/.wc")) < 0)
{
    error("tried to wc");
}
// send the wordcount and a null
if ((fileBuf = fopen("~/server/.wc", "r")) == NULL)
{
    error("tried to open .wc");
}

error just calls a function that does perror and then exits. When it tries to open the file, it prints "tried to open .wc:  No such file or directory".

Name: Anonymous 2010-09-28 6:53

Why would you help a person who puts "noko" into his sage field.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List