fopen Questions

2

Solved

Looking at the man page for fopen I cannot get a definite answer to this question. FILE *fopen(const char *path, const char *mode); I understand that fopen returns a file pointer to a stream but i...
Bordiuk asked 9/3, 2012 at 23:37

12

Solved

Is there any reason (other than syntactic ones) that you'd want to use FILE *fdopen(int fd, const char *mode); or FILE *fopen(const char *path, const char *mode); instead of int open(const...
Dentation asked 1/11, 2009 at 21:49

8

Solved

I am using the Tcpdf module and PHP to create dymanic PDF invoices from an ordering system. The script should then save the invoice into a folder called "invoices". The folder exists, and there ar...
Flummox asked 4/3, 2015 at 11:57

4

I want to open a file that is inside a folder in the current working directory like so: fopen("/folder/file.txt","r"); I'm unable to do so in this way, I get a No such file or ...
Carter asked 10/4, 2015 at 12:29

7

Solved

I'm want to read a simple string from a text file which is around 3-4 mb but fopen() fails ("can't open file" from die() is called). Here's the code: clearstatcache(); $fh = fopen("/my/path/to/fil...
Wellpreserved asked 6/9, 2011 at 8:39

11

Solved

With the Visual Studio 2005 C++ compiler, I get the following warning when my code uses the fopen() and such calls: 1>foo.cpp(5) : warning C4996: 'fopen' was declared deprecated 1> c:\program...
Barium asked 18/8, 2008 at 9:38

11

Solved

In PHP scripts, whether calling include(), require(), fopen(), or their derivatives such as include_once, require_once, or even, move_uploaded_file(), one often runs into an error or warning: F...
Alforja asked 12/4, 2016 at 14:58

6

Is there a simple way to get the number of files opened by a c++ program. I would like to do it from my code, ideally in C++. I found this blog article which is using a loop through all the availab...
Woodard asked 13/6, 2013 at 13:23

2

Solved

[Question 1] When I open a file into a function, generally I do something like this: int read_file (char *filename) { FILE *fin; if ( !(fin = fopen(filename, "r")) ) return 1; /* ... */ r...
Allfired asked 21/1, 2014 at 19:52

5

I do not understand why this is seemingly failing with errno of 2: char debugText [256]; sprintf (debugText, "C:\\List.txt"); dfile = fopen( debugText, "w"); fprintf ( dfile, " err %d \n", errno);...
Globefish asked 1/4, 2013 at 22:32

4

Solved

I appreciate there are already a lot of questions around this subject. But, as I'm not a PHP developer, I'm struggling to get anything to work for my specific object structure. I have a pretty flat...
Forrestforrester asked 12/2, 2016 at 14:4

9

Solved

I'm currently writing a program in python on a Linux system. The objective is to read a log file and execute a bash command upon finding a particular string. The log file is being constantly writte...
Mention asked 24/3, 2011 at 13:24

20

Solved

I have a file named file.txt which is update by adding lines to it. I am reading it by this code: $fp = fopen("file.txt", "r"); $data = ""; while(!feof($fp)) { $data .= fgets($fp, 4096); } echo ...
Stickinthemud asked 2/6, 2010 at 21:9

8

Solved

I am hesitated to ask this question because it looks weird. But anyway. Just in case someone had encountered the same problem already... filesystem functions (fopem, file, file_get_contents) behave...
Apiary asked 13/11, 2010 at 14:0

3

Solved

I want to write a php object in a text file. The php object is like that $obj = new stdClass(); $obj->name = "My Name"; $obj->birthdate = "YYYY-MM-DD"; $obj->position = "My position";...
Marston asked 8/9, 2013 at 6:27

6

Solved

I'm trying to see if a file contains a string that is sent to the page. I'm not sure what is wrong with this code: ?php $valid = FALSE; $id = $_GET['id']; $file = './uuids.txt'; $handle = fop...
Runofthemill asked 30/1, 2012 at 3:33

7

I'm using fopen("aaa\bbb\ccc\myfile.txt","w") to create output file. But folders aaa, bbb and ccc don't exist. What is the best way to solve this problem? Is there are any stand...
Convoke asked 20/1, 2014 at 14:28

5

Solved

I have .csv file with 4 columns. What's the easiest way to remove a line identical with the id of the first column? Here's where I got stuck: if($_GET['id']) { $id = $_GET['id']; $file_handle = ...
Luann asked 1/11, 2010 at 18:45

5

Solved

I want my C program to ask the user to type the name of the file they want to open and print the contents of that file to the screen. I am working from the C tutorial and have the following code so...
Haematic asked 26/2, 2012 at 0:4

8

Solved

I am having DNS issues with a certain target domain. I am using fopen() (but same issue with other functions) to retreive an image, but I get this error: Warning: fopen(): php_network_getaddresses...
Stalag asked 21/11, 2011 at 10:6

0

I have a Swift/SpriteKit project with an App Clip. The app clip compiles on the Simulator (though it crashes when tested via TestFlight), but I receive the error fopen failed for data file: errno =...
Shrewsbury asked 25/8, 2021 at 16:17

4

Solved

Is there a standard way to do an fopen with a Unicode string file path?
Cleanshaven asked 28/12, 2008 at 19:34

3

Solved

I wonder, if it is legimate to call fopen with NULL filename. If it is, It saves me 2 lines of code. On my GNU/Linux machine it works, but It have to be portable. I looked POSIX fopen, but it says ...
Nieshanieto asked 27/9, 2012 at 11:42

3

Solved

I am using fopen() to determine whether I'm opening a file or a directory like this: FILE *f; f = fopen(path, "r"); if (f != NULL){ // found file } else { // found a directory } A...
Hemocyte asked 18/3, 2017 at 15:28

3

Solved

I have an old "PHPDBG" function that lets me "printf" to a text file. I've had PHPDBG.inc "since forever" (at least since PHP 4.x days), but it doesn't seem to be working in my current configurat...
Laughable asked 6/3, 2019 at 2:1

© 2022 - 2025 — McMap. All rights reserved.