Questions tagged [fwrite]

fwrite stands for file write. It is a function available with PHP, C, C++, etc. for writing the contents of string to the file stream pointed to by handle.

fwrite stands for file write. It is a function available with PHP, C, C++, etc. for writing the contents of string to the file stream pointed to by handle.

PHP fwrite

Visual Studio fwrite

C++ fwrite

1762 questions
0
votes
2 answers

PHP fwrite(): Why adding rewind() doesn´t put the file pointer at the beginning of the file?

I´m testing file creation in PHP. I´m using a comment.php file that has an HTML form and points to list.php file that does all the job, actually. This is what I have at list.php: define(ARCHIVO, 'comentarios.txt'); if (!empty($_POST['nombre']) &&…
Rosamunda
  • 14,620
  • 10
  • 40
  • 70
0
votes
0 answers

php telnet fgets returns strange characters

using fsockopen, fwrite & fegts to communicate with my account on a remote server over telnet using the following code: $ip = "*hosts*"; $user = "*username*"; $pass = "*password*"; $fp = fsockopen($ip, 23, $errno, $errstr, 30); if (!$fp) { …
Dave F
  • 180
  • 1
  • 1
  • 8
0
votes
1 answer

How do write in logFile.log by Log4j (org.apache.log4j)? Give me, please, example

import org.apache.log4j.BasicConfigurator; import org.apache.log4j.Logger; class MyClass { private Logger log = Logger.getLogger(MyClass.class); public void writeInConsol() { BasicConfigurator.configure(); log.info("I write in consol!"); …
user2660852
0
votes
2 answers

Get value from select to php-fwrite

I got a little php-chat-function wich is suppose to let people write a little comment about a place they've visitted. Therfore I want the visitors to be able to select a destination from a pulldown-list.
Freshman
  • 293
  • 3
  • 8
  • 19
0
votes
2 answers

How to not print the last line

I am new to python. I want my script to print everything but the last line. I tried a [:-1] but I cant get it work. I know the code below isnt perfect as it is one of my first but it does everything I need it to do expect ... I dont want it to…
user2748540
  • 209
  • 1
  • 3
  • 12
0
votes
1 answer

Permission denied error in php when try to write in a txt file

I'm trying to write in a txt file the data i get from a html form, but I get this error: Warning: fopen(/var/www/4/datos.txt): failed to open stream: Permission denied in /var/www/4/ComprobacionFormulario.php on line 13 Warning: fwrite() expects…
Alex
  • 750
  • 5
  • 15
  • 33
0
votes
2 answers

PHP writing into text file while looping

I'm developing an app where user upload excel [.xlsx] file for dumping data into MySQL database. I have programmed in such a way that there is a LOG created for each import. So that user can see if there is any error occurred and etc.. My script was…
sravis
  • 3,562
  • 6
  • 36
  • 73
0
votes
3 answers

PHP Logging - won't add new line

I have a function called logToFile and when I call it, it logs to the file but doesn't add a new line. This is my code: function logToFile($msg) { $filename = "log.txt"; $fd = fopen($filename, "a"); $str = "[" . date("Y/m/d h:i:s",…
0
votes
1 answer

Allowing client to add data to an array which will display to a table when submit button is clicked

So here is the situation. I have a program that takes data from an array and displays it on a table. I created text input types that allows a client to input new items and when the submit button is clicked, all fields are added to the table. I…
0
votes
1 answer

Limiting # of Lines in a Log/Buffer File

I've got a small program running on an OpenWRT router that logs to a remote MySQL database. In the event that the database becomes unavailable the program writes to a buffer file (/var/buffer) to protect against data loss. Thing is, since it's being…
Kyle G.
  • 870
  • 2
  • 10
  • 22
0
votes
7 answers

Security vulnerabilities in php fwrite?

I recently transitioned my companies website over to our in-house servers (Apache) from a hosting companies (IIS). The group that originally built the site did a piss poor job and the entire thing was a mess to migrate. While the move went fairly…
malonso
  • 2,247
  • 1
  • 21
  • 33
0
votes
2 answers

How to get the size of a text file created with fwrite in php

I have a php page that creates txt files using fwrite which are then uploaded to a directory on the server. I also have a mysql database that the URL for the file is written to, is it possible to get the file size of the said file and add this to…
0
votes
1 answer

fwrite, fopen, and cronjob - not saving to proper location

I wrote a php script to get my latest Twitter tweet and save it to a file. Here is the part doing so : // No errors exist. Write tweets to json/txt file. $file = $twitteruser."-tweets.txt"; $fh = fopen($file, 'w') or die("can't open…
user756659
  • 3,372
  • 13
  • 55
  • 110
0
votes
2 answers

C++ - Creating a Wave (.Wav) file from another Wave file but with a custom header

I am really new to programming so any help from you guys would be so helpful and I would be very grateful for it. This is C++ by the way. I have a wave file that I successfully read the header of. I want to create another wave file that has every…
Cash_Lion
  • 61
  • 1
  • 8
0
votes
1 answer

change img tag structure for width and height

I have an editor in my site that will save images in this format automatically: image-alt this tag will save in static .html file and then will shows in my site…