By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,018 Members | 1,204 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,018 IT Pros & Developers. It's quick & easy.

about fwrite( )

P: n/a
how to use fwrite( ) instead of fprintf( ) in this case? I want to generate
binary file.

FILE *fnew;
int i, intName;
double array[500];

fprintf(fnew, "%d\n", intName);
fprintf(fnew, " %f", array[i]);
I know (I suppose) how to change the "intName" and "array[i]" using
fwrite( ) as follow:

fwrite(&intName, sizeof(int), 1, fnew);
fwrite(&array[i], sizeof(double), 1, fnew);

but how to hander the "\n" and " " using fwrite( )?
for example, how to handle this?

fprintf(fnew, " \n");
Nov 13 '05 #1
Share this Question
Share on Google+
23 Replies


P: n/a
On Mon, 13 Oct 2003 22:12:50 +0800, FrancisC wrote:
how to use fwrite( ) instead of fprintf( ) in this case? I want to generate
binary file.

FILE *fnew;
int i, intName;
double array[500];

fprintf(fnew, "%d\n", intName);
fprintf(fnew, " %f", array[i]);
I know (I suppose) how to change the "intName" and "array[i]" using
fwrite( ) as follow:

fwrite(&intName, sizeof(int), 1, fnew);
fwrite(&array[i], sizeof(double), 1, fnew);
fwrite(&intName, sizeof intName, 1, fnew);
fwrite(&array[i], sizeof array[i], 1, fnew);
but how to hander the "\n" and " " using fwrite( )?
for example, how to handle this?

fprintf(fnew, " \n");


Why would you want to? The data is binary, so people aren't going to read
it. Line formatting is pointless.

But, if you insist:

char s[] = " \n";
fwrite(s, sizeof s, 1, fnew);

Josh
Nov 13 '05 #2

P: n/a
"FrancisC" <fr**********@hong-kong.crosswinds.net> wrote:
how to use fwrite( ) instead of fprintf( ) in this case? I want to generate
binary file.
Generating binary files has nothing to do with whether you use fwrite()
or fprintf(), and everything with whether you fopen() your output stream
as "w" ("write - text mode") or "wb" ("write - binary mode").
FILE *fnew;
int i, intName;
double array[500];

fprintf(fnew, "%d\n", intName);


So, how _did_ you fopen() fnew?

Richard
Nov 13 '05 #3

P: n/a
Josh Sebastian wrote:

FILE *fnew;
int i, intName;
double array[500]; fwrite(&intName, sizeof(int), 1, fnew);
fwrite(&array[i], sizeof(double), 1, fnew);

fwrite(&intName, sizeof intName, 1, fnew);
fwrite(&array[i], sizeof array[i], 1, fnew);


Sorry to bother you.
In:

fwrite(&intName, sizeof (intName), 1, fnew);
fwrite(&array[i], sizeof (array[i]), 1, fnew);

I understand why you changed the second one.
Is the first more for readability? Or for maintaince?
Nov 13 '05 #4

P: n/a
how to use fwrite( ) instead of fprintf( ) in this case? I want to generate binary file.

FILE *fnew;
int i, intName;
double array[500];

fprintf(fnew, "%d\n", intName);
fprintf(fnew, " %f", array[i]);
I know (I suppose) how to change the "intName" and "array[i]" using
fwrite( ) as follow:

fwrite(&intName, sizeof(int), 1, fnew);
fwrite(&array[i], sizeof(double), 1, fnew);
fwrite(&intName, sizeof intName, 1, fnew);
fwrite(&array[i], sizeof array[i], 1, fnew);


why use sizeof (intName) and sizeof (array[i]) instead of sizeof(int) and
sizeof(double) ?
intName and array[] is set as int and double respectively
so are they both correct?
but how to hander the "\n" and " " using fwrite( )?
for example, how to handle this?

fprintf(fnew, " \n");


Why would you want to? The data is binary, so people aren't going to read
it. Line formatting is pointless.

But, if you insist:

char s[] = " \n";
fwrite(s, sizeof s, 1, fnew);


I want to maintain a file structure for later reading from the binary file.
So I think i need to, dont I?
Nov 13 '05 #5

P: n/a
how to use fwrite( ) instead of fprintf( ) in this case? I want to generate binary file.


Generating binary files has nothing to do with whether you use fwrite()
or fprintf(), and everything with whether you fopen() your output stream
as "w" ("write - text mode") or "wb" ("write - binary mode").
FILE *fnew;
int i, intName;
double array[500];

fprintf(fnew, "%d\n", intName);


So, how _did_ you fopen() fnew?

Richard


I use fnew = fopen(newFileName, "wb"), but I still can see the content
using notepad or other text editor, so i suppose it is ASCII, but I want to
generate binary file.
Nov 13 '05 #6

P: n/a
On Mon, 13 Oct 2003 23:18:21 +0800, FrancisC wrote:
> fwrite(&intName, sizeof(int), 1, fnew);
> fwrite(&array[i], sizeof(double), 1, fnew);


fwrite(&intName, sizeof intName, 1, fnew);
fwrite(&array[i], sizeof array[i], 1, fnew);


why use sizeof (intName) and sizeof (array[i]) instead of sizeof(int) and
sizeof(double) ?
intName and array[] is set as int and double respectively
so are they both correct?


Yes, they are both correct, but what if you want to later change the type
of intName from, say, an int to a long? If you do it your way, you have to
search through the source and possibly change it where you shouldn't have.
With my way, you change it once (when it's defined) and that's it.

Also, for someone later reading your code, they have to look somewhere
else to find out whether or not intName is really an int, and if not what
were you trying to do? My way, you don't care what type it is... you're
just filling it with as many bytes as it can hold.
> but how to hander the "\n" and " " using fwrite( )?
> for example, how to handle this?
>
> fprintf(fnew, " \n");


Why would you want to? The data is binary, so people aren't going to read
it. Line formatting is pointless.

But, if you insist:

char s[] = " \n";
fwrite(s, sizeof s, 1, fnew);


I want to maintain a file structure for later reading from the binary file.
So I think i need to, dont I?


No, just count bytes. If you write out spaces, you'll just have to skip
over them when you read. All it does is make more work for yourself.

Josh
Nov 13 '05 #7

P: n/a
On Mon, 13 Oct 2003 23:22:48 +0800, FrancisC wrote:
I use fnew = fopen(newFileName, "wb"), but I still can see the content
using notepad or other text editor, so i suppose it is ASCII, but I want to
generate binary file.


Text data looks (for the most part) the same. The only thing that should
change is how numbers look.

Josh
Nov 13 '05 #8

P: n/a
FrancisC wrote:
[unattributed quotation]


I know (I suppose) how to change the "intName" and "array[i]" using
fwrite( ) as follow:

fwrite(&intName, sizeof(int), 1, fnew);
fwrite(&array[i], sizeof(double), 1, fnew);


fwrite(&intName, sizeof intName, 1, fnew);
fwrite(&array[i], sizeof array[i], 1, fnew);


why use sizeof (intName) and sizeof (array[i]) instead of sizeof(int) and
sizeof(double) ?
intName and array[] is set as int and double respectively
so are they both correct?


The first form is correct provided that `intName' and
`array[i]' are an `int' and a `double', respectively. Are
they? You cannot tell by looking only at these lines; you
need to hunt for the variable declarations to be sure.

The second form is correct, even if `intName' is actually
a `long' or `short', and even if `array[i]' is a `float' or
a `long double'. It is correct even if the two variables are
`struct IntWrapper' and `struct FourDimensionalPoint'. You
can see immediately that it is correct, without rummaging
around elsewhere in the code.

The general principle is to avoid telling the compiler the
same thing twice, because you might contradict yourself by
mistake. You have already told the compiler what the types
of `intName' and `array' are, and the compiler remembers this
knowledge. The compiler's memory for this sort of fact is
more reliable than your own, so take advantage of it.

--
Er*********@sun.com
Nov 13 '05 #9

P: n/a
"FrancisC" <fr**********@hong-kong.crosswinds.net> wrote:
> fwrite(&intName, sizeof(int), 1, fnew);
> fwrite(&array[i], sizeof(double), 1, fnew);


fwrite(&intName, sizeof intName, 1, fnew);
fwrite(&array[i], sizeof array[i], 1, fnew);


why use sizeof (intName) and sizeof (array[i]) instead of sizeof(int) and
sizeof(double) ?
intName and array[] is set as int and double respectively
so are they both correct?


Both are correct, but the latter versions are easier to maintain. Think
about what happens if you decide to change the type of intName or array:
in the former versions you have to adjust the operand of sizeof, the
latter will nicely 'auto-adjust'.
> but how to hander the "\n" and " " using fwrite( )?
> for example, how to handle this?
>
> fprintf(fnew, " \n");


Why would you want to? The data is binary, so people aren't going to read
it. Line formatting is pointless.

But, if you insist:

char s[] = " \n";
fwrite(s, sizeof s, 1, fnew);


I want to maintain a file structure for later reading from the binary file.
So I think i need to, dont I?


No, you don't have to. What you have to do is remember the file
structure ("field width") when you read the file.

BTW, if you want your data files to be reliably portable between
different OSs/implementations you want to stick to the text file
approach (as binary data representations tend to vary across different
systems). Eventually converting text files (if necessary at all) is not
a big deal compared to, for example, translation between different
floating point representations.

Regards
--
Irrwahn
(ir*******@freenet.de)
Nov 13 '05 #10

P: n/a
SomeDumbGuy <ab***@127.0.0.1> wrote:
Josh Sebastian wrote:

FILE *fnew;
int i, intName;
double array[500];fwrite(&intName, sizeof(int), 1, fnew);
fwrite(&array[i], sizeof(double), 1, fnew);

fwrite(&intName, sizeof intName, 1, fnew);
fwrite(&array[i], sizeof array[i], 1, fnew);


Sorry to bother you.
In:

fwrite(&intName, sizeof (intName), 1, fnew);
fwrite(&array[i], sizeof (array[i]), 1, fnew);


Note: parantheses around these sizeof operands are redundant.
I understand why you changed the second one.
Is the first more for readability? Or for maintaince?


Both improve maintainability.

Regards
--
Irrwahn
(ir*******@freenet.de)
Nov 13 '05 #11

P: n/a
"FrancisC" <fr**********@hong-kong.crosswinds.net> wrote:
> how to use fwrite( ) instead of fprintf( ) in this case? I want togenerate > binary file.
Generating binary files has nothing to do with whether you use fwrite()
or fprintf(), and everything with whether you fopen() your output stream
as "w" ("write - text mode") or "wb" ("write - binary mode").
> FILE *fnew;
> int i, intName;
> double array[500];
>
> fprintf(fnew, "%d\n", intName);


So, how _did_ you fopen() fnew?

Richard


I use fnew = fopen(newFileName, "wb"), but I still can see the content
using notepad or other text editor, so i suppose it is ASCII,


Of course: you wrote text data to a file, what did you expect to see?
but I want to
generate binary file.


You already did; using fprintf, the binary data just happened to be
text. :-)

Regards
--
Irrwahn
(ir*******@freenet.de)
Nov 13 '05 #12

P: n/a
> how to use fwrite( ) instead of fprintf( ) in this case? I want to

generate
> binary file.

Generating binary files has nothing to do with whether you use fwrite()
or fprintf(), and everything with whether you fopen() your output stream as "w" ("write - text mode") or "wb" ("write - binary mode").

> FILE *fnew;
> int i, intName;
> double array[500];
>
> fprintf(fnew, "%d\n", intName);

So, how _did_ you fopen() fnew?

Richard


I use fnew = fopen(newFileName, "wb"), but I still can see the content
using notepad or other text editor, so i suppose it is ASCII,


Of course: you wrote text data to a file, what did you expect to see?
but I want to
generate binary file.


You already did; using fprintf, the binary data just happened to be
text. :-)


Thats why I do not want to use fprintf( ) but fwrite( ).
To make all the "things" binary, am I just need to use fwrite( ) all the
times but not using fprintf() ?
I want the filesize as small as possible and as easy for the computer to
read as possible
Nov 13 '05 #13

P: n/a
> fwrite(&intName, sizeof(int), 1, fnew);
> fwrite(&array[i], sizeof(double), 1, fnew);

fwrite(&intName, sizeof intName, 1, fnew);
fwrite(&array[i], sizeof array[i], 1, fnew);


why use sizeof (intName) and sizeof (array[i]) instead of sizeof(int) and
sizeof(double) ?
intName and array[] is set as int and double respectively
so are they both correct?


Both are correct, but the latter versions are easier to maintain. Think
about what happens if you decide to change the type of intName or array:
in the former versions you have to adjust the operand of sizeof, the
latter will nicely 'auto-adjust'.
> but how to hander the "\n" and " " using fwrite( )?
> for example, how to handle this?
>
> fprintf(fnew, " \n");

Why would you want to? The data is binary, so people aren't going to read it. Line formatting is pointless.

But, if you insist:

char s[] = " \n";
fwrite(s, sizeof s, 1, fnew);


I want to maintain a file structure for later reading from the binary file.So I think i need to, dont I?


No, you don't have to. What you have to do is remember the file
structure ("field width") when you read the file.

BTW, if you want your data files to be reliably portable between
different OSs/implementations you want to stick to the text file
approach (as binary data representations tend to vary across different
systems). Eventually converting text files (if necessary at all) is not
a big deal compared to, for example, translation between different
floating point representations.


thats mean if I want to store the file like this one (the integer is the no
of double no below):
3
100000.000000 200000.000000
300000.000000
4
100000.000000 200000.000000
300000.000000 400000.000000

in binary i should store like this with no space and new line?
3100000.000000200000.000000300000.0000004100000.00 0000200000.000000300000.00
0000400000.000000

when I want to read the file, I use the code below??

while ( !feof(fnew) )
{
fread(&intName, sizeof (intName), 1, fnew);
/*determine the integer value, intVal. (i do not know how to write this
code yet)*/
fread(&doubleNo, sizeof (doubleNo), intVal, fnew);
}



Nov 13 '05 #14

P: n/a


FrancisC wrote:
BTW, if you want your data files to be reliably portable between
different OSs/implementations you want to stick to the text file
approach (as binary data representations tend to vary across different
systems). Eventually converting text files (if necessary at all) is not
a big deal compared to, for example, translation between different
floating point representations.

thats mean if I want to store the file like this one (the integer is the no
of double no below):
3
100000.000000 200000.000000
300000.000000
4
100000.000000 200000.000000
300000.000000 400000.000000

in binary i should store like this with no space and new line?
3100000.000000200000.000000300000.0000004100000.00 0000200000.000000300000.00
0000400000.000000

when I want to read the file, I use the code below??

while ( !feof(fnew) )
{
fread(&intName, sizeof (intName), 1, fnew);
/*determine the integer value, intVal. (i do not know how to write this
code yet)*/
fread(&doubleNo, sizeof (doubleNo), intVal, fnew);
}


You have been warned that this it is not a portable to store these
values in a binary file. If you insist, here is how you might write
the code.

#include <stdio.h>
#include <stdlib.h>

int main(void)
{
int count = 3, i;
double darray[3],dd;
FILE *fp;

if((fp = fopen("test.bin","wb")) != NULL)
{ /* Create and write the int and double values to binary file*/
if(1 != fwrite(&count,sizeof count,1,fp)) exit(EXIT_FAILURE);
for(i = 0;i < count;i++)
{
dd = i+1.0;
if(1 != fwrite(&dd,sizeof dd,1,fp)) exit(EXIT_FAILURE);
}
fclose(fp);
/* Read and Test the Binary File */
if((fp = fopen("test.bin","rb")) != NULL)
{ /* read the binary file */
if(1 != fread(&count, sizeof count,1,fp))
exit(EXIT_FAILURE);
for(i = 0;i < dd;i++)
if(1 != fread(&darray[i], sizeof darray[i],1,fp))
exit(EXIT_FAILURE);
fclose(fp);
}
}
/* print contents of binary file */
printf("Reading the binary file. there are %d \n"
"type double values in the file\nThery are:\n",count);
for(i = 0; i < count;i++)
printf("darray[%d] = %.2f\n",i,darray[i]);
return 0;
}

--
Al Bowers
Tampa, Fl USA
mailto: xa*@abowers.combase.com (remove the x)
http://www.geocities.com/abowers822/

Nov 13 '05 #15

P: n/a


FrancisC wrote:
BTW, if you want your data files to be reliably portable between
different OSs/implementations you want to stick to the text file
approach (as binary data representations tend to vary across different
systems). Eventually converting text files (if necessary at all) is not
a big deal compared to, for example, translation between different
floating point representations.
thats mean if I want to store the file like this one (the integer is the no
of double no below):
3
100000.000000 200000.000000
300000.000000
4
100000.000000 200000.000000
300000.000000 400000.000000

in binary i should store like this with no space and new line?
3100000.000000200000.000000300000.0000004100000.00 0000200000.000000300000.00
0000400000.000000


In binary the above looks completely different, since numbers are stored
in the memory representation at the file. That's what binary means: no
translation when writing to the file, no translation when reading from
the file.

when I want to read the file, I use the code below??

while ( !feof(fnew) )
{
fread(&intName, sizeof (intName), 1, fnew);
/*determine the integer value, intVal. (i do not know how to write this
code yet)*/
fread(&doubleNo, sizeof (doubleNo), intVal, fnew);
}


No.
For 2 reasons:
* You don't use feof to control the loop. That's not what it is ment for.
feof() is used *after* you finish reading to check why the read has stopped.
if it was because of eof, then you have read the whole file. If it was not
because of eof, then some error has occoured.

* It is always a good idea to store some count in the file (just as you have
done it in the text version), that will guide the read process.

int count;
double numbers[100];

/* somehow you have filled the array with the numbers
** and stored a count of how many entries in the array
** you have used in count
**
** now write to file
*/
fwrite( &count, sizeof( count ), 1, fnew );
fwrite( numbers, sizeof( numbers[0] ), count, fnew );
...

/*
** and read from file
*/
fread( &count, sizeof( count ), 1, fnew );
fread( numbers, sizeof( numbers[0] ), count, fnew );
of course error checking needs to be added (use the return values
of fwrite and fread), but basically thats it.

--
Karl Heinz Buchegger
kb******@gascad.at
Nov 13 '05 #16

P: n/a
On Mon, 13 Oct 2003 11:08:45 -0400,
Josh Sebastian <cu****@cox.net> wrote:


Why would you want to? The data is binary, so people aren't going to read
it. Line formatting is pointless.

But, if you insist:

char s[] = " \n";
fwrite(s, sizeof s, 1, fnew);

Doing that will also write the terminating \0 character to the file.
That is fine if that is what you intend to do.

Villy
Nov 13 '05 #17

P: n/a
"FrancisC" <fr**********@hong-kong.crosswinds.net> wrote:

[ Please do not snip attribution lines for quotes you leave in. While
you're at it, _do_ snip text you're not responding to. ]
but I want to generate binary file.
You already did; using fprintf, the binary data just happened to be
text. :-)


Thats why I do not want to use fprintf( ) but fwrite( ).
To make all the "things" binary, am I just need to use fwrite( ) all the
times but not using fprintf() ?


This makes no sense whatsoever. The data you have _is_ text. Writing it
using another function does not magically turn it into non-text. There
is _no_ difference between a byte written using fprintf() and the same
byte written using fwrite().
You seem to be rather confused as to what "binary data" actually is.
Have you considered the existence of the utility called "strings"? Have
you ever actually loaded a "binary" file into a text (or hex) viewer?
I want the filesize as small as possible and as easy for the computer to
read as possible


Those two requirements are mutually exclusive. To make the file as small
as possible, compress it. To make it easily readable, just output the
thing!

Richard
Nov 13 '05 #18

P: n/a
On Tue, 14 Oct 2003 08:31:45 +0800, in comp.lang.c , "FrancisC"
<fr**********@hong-kong.crosswinds.net> wrote:

(lots of unattributed and untrimmed stuff)

Francis, some friendly advice: when responding to posts, please leave
the Attribution lines in (as above, the bit that says "FrancisC
wrote"), and trim your posts to remove irrelevant material.

Leaving in the attributions is important for people trying to follow a
thread, so you know who said which bit.
Trimming is important to ensure that posts to not become too long, and
relevant material appears in them.
--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
CLC readme: <http://www.angelfire.com/ms3/bchambless0/welcome_to_clc.html>
----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
Nov 13 '05 #19

P: n/a
On Tue, 14 Oct 2003 08:09:40 +0800, in comp.lang.c , "FrancisC"
<fr**********@hong-kong.crosswinds.net> wrote:
To make all the "things" binary, am I just need to use fwrite( ) all the
times but not using fprintf() ?


fwrite() dumps a block of memory to file. fprintf() prints formatted
data to a file, which might be text, or might not. Which do you want
to do?

--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
CLC readme: <http://www.angelfire.com/ms3/bchambless0/welcome_to_clc.html>
----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
Nov 13 '05 #20

P: n/a
"Mark McIntyre" <ma**********@spamcop.net> ???
news:34********************************@4ax.com ???...
On Tue, 14 Oct 2003 08:09:40 +0800, in comp.lang.c , "FrancisC"
<fr**********@hong-kong.crosswinds.net> wrote:
To make all the "things" binary, am I just need to use fwrite( ) all the
times but not using fprintf() ?


fwrite() dumps a block of memory to file. fprintf() prints formatted
data to a file, which might be text, or might not. Which do you want
to do?


Actually, I want to write a program for Palm. And the data are loaded in the
memory of Palm.
Nov 13 '05 #21

P: n/a
"FrancisC" <fr**********@hong-kong.crosswinds.net> wrote in message
news:bm***********@news.hgc.com.hk...
"Mark McIntyre" <ma**********@spamcop.net> ???
news:34********************************@4ax.com ???...
On Tue, 14 Oct 2003 08:09:40 +0800, in comp.lang.c , "FrancisC"
<fr**********@hong-kong.crosswinds.net> wrote:
To make all the "things" binary, am I just need to use fwrite( ) all thetimes but not using fprintf() ?
fwrite() dumps a block of memory to file. fprintf() prints formatted
data to a file, which might be text, or might not. Which do you want
to do?


Actually, I want to write a program for Palm. And the data are loaded in

the memory of Palm.


Well, why didn't you say so? :-)

IMO everything you need is here:
http://www.palmone.com/us/developers/

About halfway down the page, you'll find:

===========================
Create applications and add-ons for any Palm Powered device, including
licensee handhelds and communicators. This is also the place to learn about
the Palm OS platform and the strength of the growing Palm Economy.

Links:

Palm OS Developers
Getting Started
Platform Technologies
Tools & Downloads
Documentation
Support & Resources
Training
Certification
Developer Program
Resource Pavilion

===========================

BTW I found this in seconds with Google. :-)

If you decide you still want to use C to write
your programs, we can help you with the (standard)
C parts. The platform-specific parts which I'm
sure will also be needed are not topical here, but
you can get much help with that from that same site.

Oh, that'll be fifty cents for the directory assistance. :-)

HTH,
-Mike
Nov 13 '05 #22

P: n/a

"Mike Wahler" <mk******@mkwahler.net> bl
news:Lc***************@newsread4.news.pas.earthlin k.net g...
"FrancisC" <fr**********@hong-kong.crosswinds.net> wrote in message
news:bm***********@news.hgc.com.hk...
"Mark McIntyre" <ma**********@spamcop.net> ???
news:34********************************@4ax.com ???...
On Tue, 14 Oct 2003 08:09:40 +0800, in comp.lang.c , "FrancisC"
<fr**********@hong-kong.crosswinds.net> wrote:

>To make all the "things" binary, am I just need to use fwrite( ) all the >times but not using fprintf() ?

fwrite() dumps a block of memory to file. fprintf() prints formatted
data to a file, which might be text, or might not. Which do you want
to do?
Actually, I want to write a program for Palm. And the data are loaded in

the
memory of Palm.


Well, why didn't you say so? :-)

IMO everything you need is here:
http://www.palmone.com/us/developers/

About halfway down the page, you'll find:

===========================
Create applications and add-ons for any Palm Powered device, including
licensee handhelds and communicators. This is also the place to learn

about the Palm OS platform and the strength of the growing Palm Economy.

Links:

Palm OS Developers
Getting Started
Platform Technologies
Tools & Downloads
Documentation
Support & Resources
Training
Certification
Developer Program
Resource Pavilion

===========================

BTW I found this in seconds with Google. :-)

If you decide you still want to use C to write
your programs, we can help you with the (standard)
C parts. The platform-specific parts which I'm
sure will also be needed are not topical here, but
you can get much help with that from that same site.

Oh, that'll be fifty cents for the directory assistance. :-)

HTH,
-Mike


Thank you :-)
All guys here are so great and helpful
Nov 13 '05 #23

P: n/a
On Tue, 14 Oct 2003 18:09:47 +0800, in comp.lang.c , "FrancisC"
<fr**********@hong-kong.crosswinds.net> wrote:
"Mark McIntyre" <ma**********@spamcop.net> ???
news:34********************************@4ax.com ???...
On Tue, 14 Oct 2003 08:09:40 +0800, in comp.lang.c , "FrancisC"
<fr**********@hong-kong.crosswinds.net> wrote:
>To make all the "things" binary, am I just need to use fwrite( ) all the
>times but not using fprintf() ?


fwrite() dumps a block of memory to file. fprintf() prints formatted
data to a file, which might be text, or might not. Which do you want
to do?


Actually, I want to write a program for Palm. And the data are loaded in the
memory of Palm.


Yes, but C doesn't care about that. Presumably you've used a
palm-specific function to open a "file" from palm memory, then you
still have to ask "am I writing formatted data, or a chunk of memory?"

--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
CLC readme: <http://www.angelfire.com/ms3/bchambless0/welcome_to_clc.html>
----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
Nov 13 '05 #24

This discussion thread is closed

Replies have been disabled for this discussion.