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
0 answers

Can I determine whether the file descriptor is available before calling write()?

I am now working on Mac OS X, and I make myself a MYFileHandle class. This class implements file operation like NSFileHandle by POSIX system call (like read(), write(), etc), but would provide more status values. But I met a problem. If the file…
Andrew Chang
  • 1,289
  • 1
  • 18
  • 38
0
votes
1 answer

Read/Write Struct Containing Arrays to/from Binary File

I have a struct: typedef struct codeKey_s { unsigned char shortest; unsigned char longest; unsigned char lengths[256]; int table[256]; } codeKey_t; As you can see I have statically sized arrays of value types. My problem is when I…
0
votes
1 answer

C - writing buffer into a file then FREEing the buffer cause segfault

I'm writing a buffer into a binary file. Code is as in the following : FILE *outwav = fopen(outwav_path, "wb"); if(!outwav) { fprintf(stderr, "Can't open file %s for writing.\n", outwav_path); exit(1); } [...] //Create sample buffer short…
Bregalad
  • 634
  • 7
  • 15
0
votes
1 answer

Mysterious Error in Hotel Management Program - C

I have made a program for hotel management. It has a problem that: In the Accounts function, it should reset all the flags of the registered members through the program. But there is a error that it does NOT. I have spent a lot of months, trying to…
user2833365
0
votes
5 answers

PHP Write a variable to a txt file

I am trying to get a variable from the query string and write it to a text file. I have tried like this: I get the…
jayt.dev
  • 975
  • 6
  • 14
  • 36
0
votes
1 answer

C fwrite error: mcleanup

Codeblocks, C. I'm trying to write characters to a .txt file, using fwrite. The first couple of characters get written correctly, but after them the file says: _mcleanup: tos ov. I think it might be a buffer overload. Any ideas? #include…
0
votes
2 answers

Writing files to webroot in a loop, "Fatal error: ReflectionClass::getProperties()"

I am calling this function from my browser through a controller: function writePages($startPage) { for ($page=$startPage;$page<90;$page++) { $content=file_get_contents('http://www.websiteIamUsing.com/'.$page); …
Nick Manning
  • 2,828
  • 1
  • 29
  • 50
0
votes
1 answer

fwrite outputs character string incorrectly

I am currently writing a C++ program to control some LEDs by sending strings via termios to an Arduino. Each line is ended by a newline character. I have written a test program that would output to the terminal, but there are issues with the output…
MSalmo
  • 352
  • 1
  • 14
0
votes
1 answer

C++: copying bmp using loop of fread and fwrite, casues output bmp is filled with color of the fisrt one in input bmp

I dunno why, but first pixel (left bottom) is loaded correctly, but the others won't load and the first color is used for whole picture... I have this in cycle fread(&pix,sizeof(pix),1,pictureIn); fwrite(&pix,sizeof(pix),1,pictureOut); edit: pix is…
Lukas
  • 41
  • 3
0
votes
1 answer

What could cause fwrite() function so slow

I'm writing chucks of chat *ptr into file, but it takes me so long to finish. I don't know why. for(int i = 1; i < 64048; i++){ if(ptr[i] != NULL){ fwrite(ptr[i], 1, strlen(ptr[i])-6, file); free(ptr[i]); } } there is array…
Max Lin
  • 79
  • 1
  • 8
0
votes
1 answer

how to open csv with unicode data without import document

Below is how i write data with unicode character in root folder
rusly
  • 1,504
  • 6
  • 28
  • 62
0
votes
2 answers

PHP not writing to file

Ok so I have this thing setup to write things to text, but it will not actually write the txt to the file. It deletes the file then creates it again with the data inside. $_POST['IP']=$ip; unlink('boot_ip.txt'); $fp = fopen($_SERVER['DOCUMENT_ROOT']…
0
votes
3 answers

Prevent PHP File Showing

The following code receives strings from an HTML page and writes the strings to a text file. However in doing so it opens up a page in my browser with the address of the php file. How can I stay with my html page and prevent this other page from…
user984749
  • 91
  • 1
  • 6
0
votes
1 answer

fread, fwrite for big size video file (about 180MB)

I want to read a video file and save as binary and write as a video file again. I tested with 180MB video. I used fread function and It occur segmentation fault because array size is small for video. those are my questions: I use 160*1024 bytes…
YeonJu Lee
  • 33
  • 5
0
votes
2 answers

Writing large amount of data to an ascii file fast in C++

I am writing a particle tracker in C++ which releases a particle in a numerical flow field and then integrates in time to calculate the new position of the particle. This is done for as many particles as time allows (hopefully millions) for…
EJG89
  • 1,189
  • 7
  • 17