473,806 Members | 2,284 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

fprintf problem

fprintf just is not working. I am using PHP Version 4.3.9. Whatever I
do fprintf just fails.

For example:

fwrite($Handle, 'A1');
fprintf($Handle , 'A2);

The first line always works, the second always fails. Likewise any
other example.

Suggestions?

Feb 13 '07 #1
4 2717
On 13 Feb, 22:13, grim...@blackbe lts.co.uk wrote:
fprintf($Handle , 'A2);
Should be fprintf($Handle , 'A2');

That's just a typo not the problem!

Feb 13 '07 #2
gr*****@blackbe lts.co.uk wrote:
fprintf just is not working. I am using PHP Version 4.3.9. Whatever I
do fprintf just fails.

For example:

fwrite($Handle, 'A1');
fprintf($Handle , 'A2);

The first line always works, the second always fails. Likewise any
other example.

Suggestions?
'A2' isn't a format string?
Feb 13 '07 #3
Paul Lautman wrote:
gr*****@blackbe lts.co.uk wrote:
>fprintf just is not working. I am using PHP Version 4.3.9. Whatever I
do fprintf just fails.

For example:

fwrite($Handle , 'A1');
fprintf($Handl e, 'A2);

The first line always works, the second always fails. Likewise any
other example.

Suggestions?

'A2' isn't a format string?

No, that's not the issue, but unless he needs to use printed
formatting, there's no real reason to use fprintf over fwrite.

@Original Poster: how does fprintf fail, do you get an error, or is
the input not written how you expected? You need to give details, or
no one can help you.

In the meantime, try reading the manual: <http://php.net/fprintf>
Feb 14 '07 #4
On 14 Feb, 03:29, Curtis <zer0d...@veriz on.netwrote:
Paul Lautman wrote:
grim...@blackbe lts.co.uk wrote:
fprintf just is not working. I am using PHP Version 4.3.9. Whatever I
do fprintf just fails.
For example:
fwrite($Handle, 'A1');
fprintf($Handle , 'A2);
The first line always works, the second always fails. Likewise any
other example.
Suggestions?
'A2' isn't a format string?

No, that's not the issue, but unless he needs to use printed
formatting, there's no real reason to use fprintf over fwrite.

@Original Poster: how does fprintf fail, do you get an error, or is
the input not written how you expected? You need to give details, or
no one can help you.

In the meantime, try reading the manual: <http://php.net/fprintf>- Hide quoted text -

- Show quoted text -
It gives an run time error because none of the statements below it are
executed.

I got round it by using sprintf (exactly the same apart from the
different first argument) into a string, and then fwrite.

Rob

Feb 19 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
17631
by: Arti Potnis | last post by:
Hi, I have an application with a function "myfunction" that opens a file and writes to it using fprintf. This application runs on a unix (sun solaris 5.8) system. I connect to this application from a VB GUi on a windows 2000 system. The GUI invokes "myfunction". I get the following error:-
2
9529
by: hpy_awad | last post by:
formatting float variables to fprintf has error to my writing to output file called rental and I do not the reason that a rabish is written to the file instead of the actual input screen values ? #include <stdio.h> //part09_le01_file_processing_file_setup_ver_01_iti_r01_ch09.c struct name { int int___member1; float float_member2; char char__member3;
6
3505
by: hpy_awad | last post by:
I am writing stings ((*cust).name),((*cust).address)to a file using fgets but rabish is being wrote to that file ? Look to my source please and help me finding the reason why this rabish is being written. /* Book name : File name : E:\programs\cpp\iti01\ch10\ex09_5p1.cpp Program discription: Adding name,Address to customer_record SETUP PROGRAM
8
1994
by: Smegly | last post by:
Hi, I'm confused about a situation i have .. fprintf works in one function, but not in the other . . This is my part of my code for the two functions .. void customer(FILE *fin, FILE *fout, int msqid, message_buf sbuf, size_t
17
2810
by: G Patel | last post by:
E. Robert Tisdale wrote: > > int main(int argc, char* argv) { > quad_t m = {0, 1, 2, 3}; > int r; > fprintf(stdout, "m = ("); > for (size_t j = 0; j < 4; ++j) Why did you declare j as type size_t ?
7
1420
by: jchludzinski | last post by:
I tryin' to print out a string with a variable number of blanks/spaces preceding the string. I know that if I use: fprintf( stdout, "%12s", string ); I get 12 blanks preceding 'string'. If I use: n = 12; fprintf( stdout, "%(n)s: ", string );
1
4923
by: samac | last post by:
Hi all, Need some help in c. I have not been in programming for ten years. Here is my problem: From main(), I call a function - a_function(). In a_function(), I call another function b_function() and then I allocate memory for a structure using calloc() in b_function(). Data is then copied to the structure. Structure is then return to the calling function which is a_function(). I then open a file for writing and then use fprintf() to...
16
6710
by: Prayag Narula | last post by:
Hi, I want to redefine fprintf for debugging purposes. That is I want that all the output that is going to the stdout should be logged in a file. I tried something like #define fprintf (x,y,z) my_fprintf(x,y,z)
11
4309
by: David Mathog | last post by:
In the beginning (Kernighan & Ritchie 1978) there was fprintf, and unix write, but no fwrite. That is, no portable C method for writing binary data, only system calls which were OS specific. At C89 fwrite/fread were added to the C standard to allow portable binary IO to files. I wonder though why the choice was made to extend the unix function write() into a standard C function rather than to extend the existing standard C function...
0
9718
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10617
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10364
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10370
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7649
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6876
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5678
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4328
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3849
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.