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
6
votes
2 answers

fopen fprintf dosnt write to file only after closing it

how to enable the writing to file befor closing it , i have this code to write to file , is does it but only after i close the app and it gets to the distractor its part of simple logger. what i need is to see the write updates ( with tail -f )…
user63898
  • 29,839
  • 85
  • 272
  • 514
6
votes
2 answers

Matlab's fwrite: What happens to skipped bytes?

Suppose I have the following code: fid = fopen(my_filename,'w','ieee-le','ISO-8859-1'); fwrite(fid,1,'short',10,'ieee-le') Then this would open an earlier specified file, skip the first 10 bytes and write 1 into the following two. But what happens…
NewEyes
  • 407
  • 4
  • 15
6
votes
2 answers

Fastest method to deal with string

I have a text file to read and deal with with 20000 lines. In the text file I want to read the point coordinates and assign to DirectX to render.Snapshot of Text file I have used std::ifstream, getline, stringstream to get the point coordinates.…
timhu
  • 63
  • 4
6
votes
2 answers

Disable Exponential Notation when printing with fwrite r

I have run into an issue where even when I disable exponential notation, fwrite prints the number in exponential notation. An example: library(data.table) options(scipen = 999) testint = c(500000) Before I print, r behaves and does not print in…
Walker in the City
  • 527
  • 1
  • 9
  • 22
6
votes
4 answers

Multiple users write to the same file at the same time using PHP

I have a website where at the same moment, there can be multiple users writing to the same file at the same time. An example of my code is below. PHP 5.6.20
John Colbir
  • 65
  • 2
  • 5
6
votes
3 answers

How to update an ini file with php?

I have an existing ini file that I have created and I would like to know if there was a way to update a section of the file or do I have have to rewrite the entire file each time? Here is an example of my config.ini file: [config] title='test' …
WAC0020
  • 379
  • 1
  • 11
  • 27
6
votes
2 answers

PHP fwrite() for writing a large string to file

I have to write a large string 10MB to file, and I am using this line to achieve that: fwrite($file, $content); the problem is: not the whole string is written to the file, and limited to a specific limit. and fwrite always return 7933594.
user5520341
6
votes
1 answer

Php Recording a Live streaming to a file

Hi i have a live streaming code and i stream my web cam on the local host. Here is my stream file code
0qo
  • 201
  • 3
  • 10
6
votes
3 answers

fwrite write an integer

I'm trying to write a word to a file using this function: extern void write_int(FILE * out, int num) { fwrite(&num,sizeof(int),1, out); if(ferror(out)){ perror(__func__); exit(EXIT_FAILURE); } } But I get a segmentation fault…
user149100
  • 1,089
  • 3
  • 12
  • 16
6
votes
1 answer

fwrite() adds garbage data to output (WINE & Windows 7, mingw & MSVC; NOT linux/gcc)

Under certain circumstances, fwrite writes extra data (more bytes than requested). The output of a short demo is the easiest way to explain. The demo attempts to create two 2048 byte files and checks the offset after each fwrite call to determine…
br1ckd
  • 556
  • 3
  • 15
6
votes
1 answer

Using python ctypes and libc to write void pointer to binary file

I am using python ctypes and libc to interface with a vendor-provided DLL file. The purpose of the DLL file is to acquire an image from a camera. The image acquisition appears to run without error; the issue I am having is accessing the data. The…
Joe
  • 355
  • 1
  • 5
  • 17
6
votes
2 answers

Can i use fgetc() or fputc() in a binary file?

I am creating an archive program in C, and i want it to save files i provide, list and extract them. I had many issues because i used a text file for saving, and it is not the best choice if i want to process binary files like music or photos,…
Andrea Gottardi
  • 357
  • 2
  • 3
  • 21
6
votes
3 answers

using fwrite() to write a struct to a file

I have the following program: #include #include #include #define MAXLEN 100 typedef struct {int key; char data[MAXLEN];} record; main(int argc, char *argv[]) { int n, i; record x; FILE *fp; fp =…
me45
  • 1,059
  • 3
  • 14
  • 16
6
votes
2 answers

Python 2.7.3 . . . Write .jpg/.png image file?

So I have a .jpg/.png and I opened it up in Text Edit which I provided below: Is there anyway I can save these exotic symbols to a string in Python to later write that to a file to produce an image? I tried to import a string that had the beta…
O.rka
  • 29,847
  • 68
  • 194
  • 309
6
votes
3 answers

set utf-8 encoding for fread fwrite

hi i use this code read and write text in file . $d = fopen("chat.txt", "r"); $content=fread($d,filesize('chat.txt')); $bn=explode('||',$content); foreach($bn as $bn) echo $bn.'
'; and $d = fopen("chat.txt", "a"); $c=$_GET['c']; …
behzad n
  • 239
  • 3
  • 5
  • 15