Questions tagged as 'fopen'

1
answer

Problems with reading and writing

Assuming you have an access log, each request will create or add values to the log file. Simulating multiple requests via ajax, I've found that there is always a problem. If you enter the browser console and run the code below, a request will...
asked by 08.12.2014 / 02:51
1
answer

Problem with accent when generating txt in php

I am using the code below to generate a txt file but it is generating a strange code. <?php header("Content-Type: text/html; charset=UTF-8",true); $fp = fopen("bloco.txt", "w"); $eu = 'é'; fwrite($fp, $eu); fclose($fp); ?>     
asked by 12.09.2018 / 16:47
2
answers

How to open a file using php?

Good afternoon everyone !! I'm trying to implement a program where I have to get .txt files from a folder, open them and grab the contents of this file to store in the database, I'm having trouble opening the file and viewing the contents usi...
asked by 13.05.2016 / 19:38
1
answer

Reading file in Objective C

I'm trying to read a file in .c, I can read everything right there however in the variable it returns me a whole content and a "\ n" that damages the rest of my code. Below is the section that reads the txt for you to analyze. char * info_cont...
asked by 19.09.2014 / 00:37
2
answers

Cut text problem when creating text file

I need to create a file that contains PHP code. This code comes from a string like "<?php class foo{ } ?>" but when I give a echo it just cuts the reserved words. How to turn the string into plain text without missing a wo...
asked by 28.04.2014 / 05:16
0
answers

How to do a Json_Decode of a file in json format

Hello, I'm currently storing json data in a file using fopen. $json = fopen("$root/apil/Controllers/json/" . $this->getX_id() . ".json", "w+"); $customers_results = $customers->fetchAll(PDO::FETCH_OBJ); foreach ($c...
asked by 25.09.2018 / 16:47
1
answer

Save std :: cout to file

I need to adapt some exits from the program Ripser . More precisely, I need to do the following: 1. Running the program in an example, we have: ./ripser examples/random16.lower_distance_matrix whose output is distance matrix with 1...
asked by 17.11.2017 / 01:48
1
answer

Create / Edit a file on the server (Apache)

With the following code I would like to create a file on the server. <?php date_default_timezone_set('America/Sao_Paulo'); $nomeArquivoLogDia = date('Ymd') . '-teste.log'; if (file_exists($nomeArquivoLogDia)) { $arquivo...
asked by 26.05.2017 / 03:53
1
answer

How to make the code write information from multiple files?

I have a code to create watermark on each image that was uploaded. At the end of this code, I would like every time a person uploaded the image, a record was created in a notebook. I came to this code but I'm having a hard time getting it to kee...
asked by 30.12.2015 / 12:35
1
answer

New PHP line in fopen function

Well, I've been following a PHP tutorial and everything is fine, but the problem is to write the data in a windows notepad, instead of giving it a new line "\ n", it is putting the data one after the other as if you did not enter, I will post th...
asked by 30.09.2015 / 05:47