02-05-2005
fopen and open
what is the difference between
fopen and open
fread and read
fwrite and write
open and create
why this much of functions for the i/o when everything does the same...?
What is their major difference?
In which case, which is the best to use.
'ed Collins
10 More Discussions You Might Find Interesting
1. Programming
Hi
I was trying to open a file with french name on Mac OS-X with open() and fopen() but it didn't work.Do we have any POSIX unix func. which can be used to open any file with special name.
if anybody has an idea plz help.
Thanks
Mohit (1 Reply)
Discussion started by: mohit grover
1 Replies
2. Programming
hello..
i make some code with C in freebsd 5.4 and compile it in solaris
somehow i succeed compile the program.
but when i run it, i got error message "Broken Pipe"
i looked out the syntax that that caused this,
fp = fopen("file.tmp","r");
does anyone know why, and how to solve this... (3 Replies)
Discussion started by: kuampang
3 Replies
3. Programming
For reading in large text files (say files over 1kB in size) are there any issues with fopen() that I should be aware of ?
cheers (2 Replies)
Discussion started by: JamesGoh
2 Replies
4. Web Development
Dear all,
I'm a newbie for PHP and TCPDF ,I have to change the URL to PDF, so I used FPDF , But it cannot convert most of the advanced HTML tags. So explored again and found TCPDF , it can do most of the tag but I cannot found to change URL to PDF. So Does anyone can point the example... (0 Replies)
Discussion started by: athae
0 Replies
5. UNIX for Advanced & Expert Users
Hello!
I'm having problems with fopen() call in Linux.
I have shared library (created by myself) that implements some file operations:
int lib_func(char* file_name) {
...
fd = fopen(file_name, "r");
if(!fd) {... exit with error ...}
...
do something useful using fd
...
... (2 Replies)
Discussion started by: kalbi
2 Replies
6. Programming
This code works fine when I use a command line argument for fopen()'s parameter, but when I change it to a filename, the program freezes upon compilation. input.txt is definitely there, so I can't figure it out. Thanks.
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
int... (3 Replies)
Discussion started by: lazypeterson
3 Replies
7. Programming
I always assumed the fopen/freopen is very costly, so when I needed to work with many files within on process I spent extra time to implement a list of FILE * pointers to avoid extra open/reopen but it did not produced any better results.
Here is a task at hand - there is a huge stream of data... (4 Replies)
Discussion started by: migurus
4 Replies
8. Programming
Hi All,
Although this code is quite long but it does not require one to understand the logic of the code. I am trying to run this code on my Linux machine using gcc. But when this line is executed:
output_pointer = fopen ( file_name , "w" );I get segmentation fault. I've been breaking my head... (17 Replies)
Discussion started by: shoaibjameel123
17 Replies
9. Programming
Hello,
I have a problem here, I want to write a function called"myfopen()" instead of "fopen()"
for writing this function I must not use the <stdio.h> library,
Can you help me?
thanks a lot (2 Replies)
Discussion started by: hamed.samie
2 Replies
10. Shell Programming and Scripting
5Thank you to those who responded.
After a crazy amount of troubleshooting and getting hints and feedback from others, I was so darn determined to get on with my tutorials and I found the solution myself.
Keyword search: php and 'Mac computer' and fopen and chmod.
Using:php and Mac and... (1 Reply)
Discussion started by: iHaveAQuestion
1 Replies
REWIND(3) 1 REWIND(3)
rewind - Rewind the position of a file pointer
SYNOPSIS
bool rewind (resource $handle)
DESCRIPTION
Sets the file position indicator for $handle to the beginning of the file stream.
Note
If you have opened the file in append ("a" or "a+") mode, any data you write to the file will always be appended, regardless of the
file position.
PARAMETERS
o $handle
- The file pointer must be valid, and must point to a file successfully opened by fopen(3).
RETURN VALUES
Returns TRUE on success or FALSE on failure.
EXAMPLES
Example #1
rewind(3) overwriting example
<?php
$handle = fopen('output.txt', 'r+');
fwrite($handle, 'Really long sentence.');
rewind($handle);
fwrite($handle, 'Foo');
rewind($handle);
echo fread($handle, filesize('output.txt'));
fclose($handle);
?>
The above example will output something similar to:
Foolly long sentence.
SEE ALSO
fread(3), fseek(3), ftell(3), fwrite(3).
PHP Documentation Group REWIND(3)