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
1 answer

Warning: fwrite() expects parameter 1 to be resource, null given

I am working on a facebook app and I am trying to write in a file that was opened in another php, but doesn't seem to work. My code looks like this: myphp.php include…
Mihai Bujanca
  • 4,089
  • 10
  • 43
  • 84
0
votes
1 answer

Save an excel/cvs file from mysql using PHP [run via a cron job]

I have some results from a mysql table that I would like to export, I am currently able to click a download link and download an xls but I would like to be able to run this via a cron job and have the weekly results email to me. I have looked at…
Sean
  • 95
  • 1
  • 8
0
votes
1 answer

Using fwrite() and displaying the text in a text box before submitting but every time i submit my text saves and then a number is saved after it?

I am using fwrite() to write to a .txt file. I have a home page which displays the text from the .txt file. seems to be working ok. I then have an 'admin' page which on submit, will fwrite() the contents of my textarea to the file... by default on…
Joeseppi
  • 58
  • 6
0
votes
1 answer

Broken PHP script - fwrite and variables

Processing $_POST data through the following PHP script with 'mike' and 'tampa' being the post data:
DMSJax
  • 1,709
  • 4
  • 22
  • 35
0
votes
1 answer

C++ fwrite() in hex

Writing code with Winsock. I currently have this: fwrite(buff, 1, len, stdout); How to do it like: for ( int i = 0; i < len; i++ ) { printf( "%02x ", unsigned char (buff[i]) ); } printf( "\n" ); Or should I just remove the fwrite and use the print…
zikdaljin
  • 95
  • 2
  • 5
  • 14
0
votes
1 answer

Download a CSV file on an external server

The code below works on my localhost test machine, but I need to know how to get it to work on an external server. I need to be able to download the .csv file. Is there a way I can prompt the user to download the file or do I have to choose a…
JimRomeFan
  • 407
  • 6
  • 19
0
votes
1 answer

Deleting specific data from a text document using fwrite?

I am writing an "unfriend" script for my mini social network, basically the unfriend action needs to remove their id called: $user from their friend list and my id called: $my_id. I have made the scripts that add user id's to each users files but I…
0
votes
2 answers

PHP fwrite writes 0 bytes

I have tested this over and over and for some reason the code writes 0 on my file but when i do echo it writes the intended text. HERE IS MY CODE:
Carlos Flores
  • 29
  • 2
  • 9
0
votes
2 answers

writing a CString into a .bin file

I have a CString with 'HEX' values, which looks something like this: "0030303100314a" Now I want to store this into a bin file, so that if I open it with a hex-editor, the data us displayed is displayed like in the string: 00 30 30 30 31 00 31 4a I…
Andreas D.
  • 73
  • 1
  • 12
0
votes
3 answers

Issue with writing data into an existing CSV file using ruby

test1.csv yearID,teamID,lgID,playerID,salary 1985,BAL,AL,boddimi01,625000 1985,BAL,AL,dauerri01,480000 1985,BAL,AL,davisst02,437500 1986,BAL,AL,dempsri01,512500 1986,BAL,AL,dwyerji01,375000 1987,BAL,AL,flanami01,641667 This is my ruby…
gkolan
  • 1,571
  • 2
  • 20
  • 37
0
votes
2 answers

Using fread & fwrite, in relation to binary

I'm having trouble getting to understand why my code is not working as intended, and I'm sure it has to do with my understanding of fread and fwrite. Here is a snippet of my code, excuse the formatting and lazy style. typedef struct record_t{ char…
husked
  • 3
  • 3
0
votes
1 answer

How does PHP interpret local paths and where does it open files?

I'm trying to figure out how a WordPress theme works. For this, I want to write to a file from various functions. The file is at the root of the site. fwrite(fopen("output.txt", "a"), "Test output\n"); From /test.php, this outputs to /output.txt.…
technillogue
  • 1,482
  • 3
  • 16
  • 27
0
votes
1 answer

EXC_BAD_ACCESS error on fwrite using underlying array from vector class

I am stumped with this EXC_BAD_ACCESS error. I am using zlib to compress and save some data from the array ch in the function deflateReadOut which is called from the function generate. The program fails at the fwrite on the marked line. class…
ymom11
  • 1
  • 1
0
votes
3 answers

Add Word document to another Word document with PHP

How can I add a Word document to another Word document with PHP (fwrite)? $filename = "./1.doc"; $handle = fopen($filename, "r"); $contents = fread($handle, filesize($filename)); $filename2 = "./2.doc"; $handle2 = fopen($filename2,…
jsmb
  • 1
  • 1
0
votes
1 answer

Trouble using fread to change struct value C

My problem here is that, I think..., everything works fine, but the actual block variable isn't changing. It is of BLOCK size, which is 512 bytes, the first for bytes of which are listed as block.head[0,1,2,3]. So my program uses block.head[] to see…
user2208569
  • 109
  • 1
  • 11