Questions tagged as 'fopen'

2
answers

How to count the number of characters of the word that came from the first line of a text file?

Below is an example of how to count the number of characters in a string: $palavra ="coisa"; echo strlen($palavra); //retorna o número 5 However, I'm getting this word from a text file and strlen is not working, see: $f = fopen("palavra...
asked by 24.08.2014 / 16:56
2
answers

What does the expression "a + t" mean in the second parameter of fopen in C?

I was encountering a code here and I was curious about this passage: FILE *fp = fopen("Agenda.txt","a+t"); What is "a+t" ?     
asked by 19.05.2017 / 05:25
2
answers

Adding data to a txt file

I have the following code: $msg = "teste"; $myfile = fopen("lista.txt", "w"); fwrite($myfile, $msg."\n"); fclose($myfile); If I change the value of the variable $msg it opens the file deletes the $msg previous and replaces it...
asked by 08.10.2018 / 21:34
1
answer

Read a list of lists in txt python 3

I have a list of very giant lists and it gets in the way of my code. So I wanted to save this list into a txt file and ask the algorithm to save this list into a new variable. Let's assume my list of lists is: [[[1],[2]],[[3],[4]]]...
asked by 25.08.2017 / 14:52
1
answer

Error creating a file with fopen

When trying to create a JSON file with fopen me, a permission error is returned with the following message:   Warning: fopen (/json/9.json): failed to open stream: No such file or directory in C: \ xampp \ htdocs \ apil \ Controllers \...
asked by 20.09.2018 / 15:36
1
answer

php can not copy remote file, but it downloads via browser

Hello. This file: link I can download through the browser, but I can not copy directly to my server using PHP. I have tested all possible ways (copy (), file_gets_content (), fopen (), curl (), etc) and there is no way to make it work. H...
asked by 10.11.2016 / 16:33
1
answer

Problem with fopen

This file is performing its function perfectly, but it is returning some errors and I would like to correct them. I need to know if I have to use fopen and file_get_contents because I can not undo any. # /pasta/copy.php <?php...
asked by 14.03.2015 / 22:45
2
answers

Doubt about PHP command to write inside another .php file

I'm encountering a problem in the following code: <?php $id = $_POST['id']; $titulo = $_POST['titulo']; $imagem = $_POST['imagem']; $coment = $_POST['coment']; $finalcoment = '<div id="triplox"><a name="index-' . $id . '"><...
asked by 08.10.2016 / 16:31
2
answers

Giving "Segmentation fault" when trying to open files in C

The following code gives me "Segmentation fault (core dumped)" when trying to open the file after declaration and filling a string with sprintf. //Sem as duas seguintes linhas, o código roda normalmente char Xseqpath[90]; sprintf(Xseqpath, "%s...
asked by 12.04.2018 / 14:18
2
answers

Help determining vector / array size - Language C

What I would like to do is put in a vector or array, information from a txt file without prior knowledge of the number of "entries" to know the size of the array or array. With the size of the array or array, I can invoke the function...
asked by 17.12.2014 / 23:22