473,387 Members | 1,904 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

I've problem with my file handling program. See this

When I run this program.
#include<stdio.h>

int main()
{
FILE *fp;

int i;
float f;
char str[20];

if( ( fp=fopen("stuff", "w")) == NULL )
{
printf("Sorry! Unable to create/read stuff");
exit(-1);
}

for( i=0; i<=10; i++ )
fprintf(fp, "%d:%s:%.2f\n", i, "Hello", 12.3f);

for( i=0; i<=5; i++)
{
fscanf( fp, "%d:%s:%.2f\n" , &i, &str, &f);
printf("Hi %s %d %f\n", str, i, f);
}

fclose(fp);
return 0;
}

This is the output:
$./a.out
Hi |àÇù¿-F¦Yâ 0 0.000000
Hi |àÇù¿-F¦Yâ 1 0.000000
Hi |àÇù¿-F¦Yâ 2 0.000000
Hi |àÇù¿-F¦Yâ 3 0.000000
Hi |àÇù¿-F¦Yâ 4 0.000000
Hi |àÇù¿-F¦Yâ 5 0.000000

The contents of the file are:
$cat stuff
0:Hello:12.30
1:Hello:12.30
2:Hello:12.30
3:Hello:12.30
4:Hello:12.30
5:Hello:12.30
6:Hello:12.30
7:Hello:12.30
8:Hello:12.30
9:Hello:12.30
10:Hello:12.30

Why is this happening when I'm reading string and float values. Help me
where I'm wrong
Thanks in advance

Sep 12 '06 #1
21 2500

Rajen wrote:
When I run this program.
#include<stdio.h>

int main()
{
FILE *fp;

int i;
float f;
char str[20];

if( ( fp=fopen("stuff", "w")) == NULL )
Should have been either 'fopen("stuff",,"rw")' or
'fopen("stuff",,"r+")'
{
printf("Sorry! Unable to create/read stuff");
exit(-1);
}

for( i=0; i<=10; i++ )
fprintf(fp, "%d:%s:%.2f\n", i, "Hello", 12.3f);
And here the file pointer has to be brought to the beginning of the
file, or to the position from which you wanted to read the contents of
the file. Something like, 'rewind(fp)' would do that.

for( i=0; i<=5; i++)
{
fscanf( fp, "%d:%s:%.2f\n" , &i, &str, &f);
printf("Hi %s %d %f\n", str, i, f);
}

fclose(fp);
return 0;
}

This is the output:
$./a.out
Hi |àÇù¿-F¦Yâ 0 0.000000
Hi |àÇù¿-F¦Yâ 1 0.000000
Hi |àÇù¿-F¦Yâ 2 0.000000
Hi |àÇù¿-F¦Yâ 3 0.000000
Hi |àÇù¿-F¦Yâ 4 0.000000
Hi |àÇù¿-F¦Yâ 5 0.000000
But I am not aware of what produced the above output.
>
The contents of the file are:
$cat stuff
0:Hello:12.30
1:Hello:12.30
2:Hello:12.30
3:Hello:12.30
4:Hello:12.30
5:Hello:12.30
6:Hello:12.30
7:Hello:12.30
8:Hello:12.30
9:Hello:12.30
10:Hello:12.30

Why is this happening when I'm reading string and float values. Help me
where I'm wrong
Thanks in advance
Sep 12 '06 #2
In article <11*********************@m73g2000cwd.googlegroups. com>,
Rajen <ra*****@gmail.comwrote:
>When I run this program.
Please don't post in MIME encoding. I have to manually decode the
mime to answer your question.
#include<stdio.h>

int main()
{
FILE *fp;

int i;
float f;
char str[20];

if( ( fp=fopen("stuff", "w")) == NULL )
{
printf("Sorry! Unable to create/read stuff");
exit(-1);
}

for( i=0; i<=10; i++ )
fprintf(fp, "%d:%s:%.2f\n", i, "Hello", 12.3f);

for( i=0; i<=5; i++)
{
fscanf( fp, "%d:%s:%.2f\n" , &i, &str, &f);
You have several problems here.

- you are trying to read from the end of a file

- you have not flushed the output buffer

- you are trying to read from a file while it is in write mode; you
need to use rewind() or fseek() to switch to read mode

- you are printing out a ':' after the "Hello" and you are
expecting that when you fscanf() with %s format that that ':' will mark
the end of the "Hello" string. It will not, however: the %s format
reads to the next white-space. If you only want to read as far as
the next : then you need to use %[^:] as your format specifier.

- you have not protected yourself in case the input string read into
str is larger than your buffer (20 including the \0 you want to
terminate the string)

- int main() should be int main(void)
printf("Hi %s %d %f\n", str, i, f);
}

fclose(fp);
return 0;
}
--
All is vanity. -- Ecclesiastes
Sep 12 '06 #3

"Walter Roberson" <ro******@ibd.nrc-cnrc.gc.cawrote in message
news:ee**********@canopus.cc.umanitoba.ca...
In article <11*********************@m73g2000cwd.googlegroups. com>,
Rajen <ra*****@gmail.comwrote:
When I run this program.

Please don't post in MIME encoding. I have to manually decode the
mime to answer your question.
You didn't mention how you wanted him to post (ASCII text) so his next post
might be HTML, UUE, etc...

You didn't check to see if he was posting from Google...(i.e., the format
might not be his choice).

You should be able to adjust _your_ newsreader settings to display the
message _properly_.

If he's using MS Outlook Express, the new message will have a "Format" menu
and "Plain Text" option.
Rod Pemberton
Sep 12 '06 #4
Walter Roberson wrote:
>
In article <11*********************@m73g2000cwd.googlegroups. com>,
Rajen <ra*****@gmail.comwrote:
When I run this program.

Please don't post in MIME encoding. I have to manually decode the
mime to answer your question.
[...]

According to my newsreader, his message has no "MIME encoding":

Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

--
+-------------------------+--------------------+-----------------------+
| Kenneth J. Brody | www.hvcomputer.com | #include |
| kenbrody/at\spamcop.net | www.fptech.com | <std_disclaimer.h|
+-------------------------+--------------------+-----------------------+
Don't e-mail me at: <mailto:Th*************@gmail.com>

Sep 12 '06 #5
Kenneth Brody said:
Walter Roberson wrote:
>>
In article <11*********************@m73g2000cwd.googlegroups. com>,
Rajen <ra*****@gmail.comwrote:
>When I run this program.

Please don't post in MIME encoding. I have to manually decode the
mime to answer your question.
[...]

According to my newsreader, his message has no "MIME encoding":

Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
If you look at the original message source (typically via Message/View
Source or Properties/Original Message or something along those lines,
depending on your newsreader), I think you will see his point.

For example, if( ( fp=3Dfopen("stuff", "w")) =3D=3D NULL )

which is never going to compile. :-)

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at above domain (but drop the www, obviously)
Sep 12 '06 #6
In article <ee**********@main.corriga.net>,
Rod Pemberton <do*********@bitfoad.cmmwrote:
>"Walter Roberson" <ro******@ibd.nrc-cnrc.gc.cawrote in message
news:ee**********@canopus.cc.umanitoba.ca...
>Please don't post in MIME encoding. I have to manually decode the
mime to answer your question.
>You didn't mention how you wanted him to post (ASCII text) so his next post
might be HTML, UUE, etc...
And then you get into the arguments about how the 7 bit MIME encodings
*are* in ASCII text, and round and round it goes.

I didn't have time for an exposition on encoding formats, and such
would have been only marginally relevant to the newsgroup.

>You didn't check to see if he was posting from Google...(i.e., the format
might not be his choice).
The format is a choice even with Google. It just might not be an obvious
choice.

>You should be able to adjust _your_ newsreader settings to display the
message _properly_.
Well I can't. The mime decoding program I would need is the legal
property of a bankrupt corporation (#1) which had bought it from another
company (#2) which had bought it from yet another company (#3) which
discontinued officially discontinued it a decade ago after having
bought it from a spin off of another company that wrote it (#4). Several
people tried going through all the legal hoops with the first two
forks (#3 and #2) and were completely unsuccessful: the spin-off (#2)
made a deliberate policy decision to withdraw it from the market and
keep it off, and none of the successor companies was willing to go through
the internal mechanisms to sort things out.

You are assuming that my equipment supports the character set the
posting in question was written in; that's a poor assumption, and
switching to a GUI newsreader to -draw- the characters is not an
acceptable solution.

Alternate encodings are also not in accordance with Usenet standards
so I'll thank you not to go telling me that I need to adjust *my* end.

>If he's using MS Outlook Express, the new message will have a "Format" menu
and "Plain Text" option.
I wouldn't know. That's a platform specific piece of information
for a platform that I don't use. As Outlook Express is not the
topic of this newsgroup, it is highly recommended that you do not
post technical information about it here, where Outlook Express experts
are not necessarily available to review your information and correct it
or give additional guideance if necessary.
I'm not sure why you felt the need to pick on me for keeping on
topic and not giving out platform-specific information that
is not the topic of the newsgroup and which I don't know.
--
I was very young in those days, but I was also rather dim.
-- Christopher Priest
Sep 12 '06 #7
In article <45***************@spamcop.net>,
Kenneth Brody <ke******@spamcop.netwrote:
>Walter Roberson wrote:
>Please don't post in MIME encoding. I have to manually decode the
mime to answer your question.
>According to my newsreader, his message has no "MIME encoding":
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Content-Type and Content-Transfer-Encoding *are* MIME headers.
quoted-printable encoding is defined by RFC 1521,
"MIME (Multipurpose Internet Mail Extensions) Part One"
--
There are some ideas so wrong that only a very intelligent person
could believe in them. -- George Orwell
Sep 12 '06 #8
Walter Roberson wrote:
In article <11*********************@m73g2000cwd.googlegroups. com>,
Rajen <ra*****@gmail.comwrote:
When I run this program.

Please don't post in MIME encoding. I have to manually decode the
mime to answer your question.
He's posting from Google, and I don't believe there's any control over
that sort of thing.

Brian
Sep 12 '06 #9
Richard Heathfield wrote:
Kenneth Brody said:
Walter Roberson wrote:
>
In article <11*********************@m73g2000cwd.googlegroups. com>,
Rajen <ra*****@gmail.comwrote:
When I run this program.

Please don't post in MIME encoding. I have to manually decode the
mime to answer your question.
[...]

According to my newsreader, his message has no "MIME encoding":

Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

If you look at the original message source (typically via
Message/View Source or Properties/Original Message or something along
those lines, depending on your newsreader), I think you will see his
point.
He (the OP) is posting from Google. There was some question about the
"quoted-printable" in another newsgroup, which I seemed to recall was
only for replies but perhaps not. At any rate, it's not something that
is easy for the OP to deal with, if possible at all.

Most newsreaders these days handle quoted-printable, but obviously
there are some that don't or can be set to not do so. One of the
problems I have with my newsreader is that it wraps text at the
boundary I specify, even if it's a long URI. The designer of the
program told me just to post in q-p, but I'm an old usenet hand and
reluctant to do so.


Brian (tradeoffs here, tradeoffs there)

Sep 12 '06 #10
In article <4m************@individual.net>,
Default User <de***********@yahoo.comwrote:
>Walter Roberson wrote:
>In article <11*********************@m73g2000cwd.googlegroups. com>,
Rajen <ra*****@gmail.comwrote:
When I run this program.
>Please don't post in MIME encoding. I have to manually decode the
mime to answer your question.
>He's posting from Google, and I don't believe there's any control over
that sort of thing.
It might have been due to posting characters not representable
in ASCII (which is the character set mandated for NNTP).

I -speculate- that if only the ASCII subset is used, and no
attachments (or multiparts etc) that google does not include
the content-encoding: header.
--
If you lie to the compiler, it will get its revenge. -- Henry Spencer
Sep 12 '06 #11
Walter Roberson wrote:
In article <4m************@individual.net>,
Default User <de***********@yahoo.comwrote:
Walter Roberson wrote:
In article <11*********************@m73g2000cwd.googlegroups. com>,
Rajen <ra*****@gmail.comwrote:
When I run this program.
Please don't post in MIME encoding. I have to manually decode the
mime to answer your question.
He's posting from Google, and I don't believe there's any control
over that sort of thing.

It might have been due to posting characters not representable
in ASCII (which is the character set mandated for NNTP).

I -speculate- that if only the ASCII subset is used, and no
attachments (or multiparts etc) that google does not include
the content-encoding: header.

That could be. That kind of makes sense, as Google isn't really a
newsreader with settings for the most part. An automatic switch to some
sort of encoding when needed is probably the easiest solution.


Brian
Sep 12 '06 #12
On Tue, 12 Sep 2006 03:59:25 -0400, in comp.lang.c , "Rod Pemberton"
<do*********@bitfoad.cmmwrote:
>You should be able to adjust _your_ newsreader settings to display the
message _properly_.
why? The OP is the one quoting in a weird fashion, and not all
newsreaders offer the facility to decode weird formats.

--
Mark McIntyre

"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it."
--Brian Kernighan
Sep 12 '06 #13
Mark McIntyre wrote:
On Tue, 12 Sep 2006 03:59:25 -0400, in comp.lang.c , "Rod Pemberton"
<do*********@bitfoad.cmmwrote:
You should be able to adjust your newsreader settings to display the
message properly.

why? The OP is the one quoting in a weird fashion, and not all
newsreaders offer the facility to decode weird formats.
Again, he's not actually doing anything, Google is. There is no
facility for the user to correct the problem, short of not using Google
to post non-ASCII characters.


Brian
Sep 12 '06 #14
In article <4m************@individual.net>,
Default User <de***********@yahoo.comwrote:
>Again, he's not actually doing anything, Google is. There is no
facility for the user to correct the problem, short of not using Google
to post non-ASCII characters.
There isn't any other method of posting non-ASCII characters that
is acceptable either. nntp is ASCII only, as are all Big 8 Newsgroups
unless otherwise chartered.
--
"It is important to remember that when it comes to law, computers
never make copies, only human beings make copies. Computers are given
commands, not permission. Only people can be given permission."
-- Brad Templeton
Sep 12 '06 #15
Walter Roberson wrote:
In article <4m************@individual.net>,
Default User <de***********@yahoo.comwrote:
Again, he's not actually doing anything, Google is. There is no
facility for the user to correct the problem, short of not using
Google to post non-ASCII characters.

There isn't any other method of posting non-ASCII characters that
is acceptable either. nntp is ASCII only, as are all Big 8 Newsgroups
unless otherwise chartered.

Right. There's just no point in hammering on the guy, as he didn't do
anything intentional, probably, to do that.

I've found it helpful for me to identify Google users. To do that, I
added a header line to the ones displayed at the top of messages, so if
I see:

User-Agent: G2/1.0
I can tailor advice/criticism appropriately. This started in the "no
quote" days, but I've found it useful to keep for circumstances like
the one we have here.

Brian
Sep 13 '06 #16
Richard Heathfield wrote:
>
Kenneth Brody said:
Walter Roberson wrote:
>
In article <11*********************@m73g2000cwd.googlegroups. com>,
Rajen <ra*****@gmail.comwrote:
When I run this program.

Please don't post in MIME encoding. I have to manually decode the
mime to answer your question.
[...]

According to my newsreader, his message has no "MIME encoding":

Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

If you look at the original message source (typically via Message/View
Source or Properties/Original Message or something along those lines,
depending on your newsreader), I think you will see his point.

For example, if( ( fp=3Dfopen("stuff", "w")) =3D=3D NULL )
Ahh... I was looking for the "obvious" stuff, like BASE64, or
multipart posting.
which is never going to compile. :-)

Why? Your library doesn't include the 3Dfopen() function? :-)

--
+-------------------------+--------------------+-----------------------+
| Kenneth J. Brody | www.hvcomputer.com | #include |
| kenbrody/at\spamcop.net | www.fptech.com | <std_disclaimer.h|
+-------------------------+--------------------+-----------------------+
Don't e-mail me at: <mailto:Th*************@gmail.com>
Sep 13 '06 #17
On 12 Sep 2006 23:29:21 GMT, in comp.lang.c , "Default User"
<de***********@yahoo.comwrote:
>Mark McIntyre wrote:
>On Tue, 12 Sep 2006 03:59:25 -0400, in comp.lang.c , "Rod Pemberton"
<do*********@bitfoad.cmmwrote:
You should be able to adjust your newsreader settings to display the
message properly.

why? The OP is the one quoting in a weird fashion, and not all
newsreaders offer the facility to decode weird formats.

Again, he's not actually doing anything, Google is. There is no
facility for the user to correct the problem, short of not using Google
to post non-ASCII characters.
I'm struggling to understand why a space is a non-ascii character.
Don't bother to explain, I actually don't care. If google is so broken
that it posts in fonts that don't contain space characters, then....
--
Mark McIntyre

"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it."
--Brian Kernighan
Sep 13 '06 #18
In article <g8********************************@4ax.com>,
Mark McIntyre <ma**********@spamcop.netwrote:
>I'm struggling to understand why a space is a non-ascii character.
Don't bother to explain, I actually don't care. If google is so broken
that it posts in fonts that don't contain space characters, then....
The original posting contained sample output of the program. That
sample output included non-ASCII characters. The quoted-printable
encoding string was =E0=C7=F9=BF-F=A6Y=E2 which would correspond to
"\xE0\xC7\xF9\xBF-F\xA6Y\xE2" or
"\340\307\371\277-F\246Y\342" .

In 8859-1 these characters correspond to (respectively)
lowercase-a with ` accent
capital C with a cidile
lowercase-u with ` accent
upsidedown question mark
broken bar
lowercase-a with circumflex

The posting also contained incidental encodings of all the equal
signs (because they introduce quoted-printable characters), and
as well an encoding of a period that happened to occur at the
beginning of a line.
--
I was very young in those days, but I was also rather dim.
-- Christopher Priest
Sep 13 '06 #19

Walter Roberson wrote:
In article <11*********************@m73g2000cwd.googlegroups. com>,
Rajen <ra*****@gmail.comwrote:
When I run this program.

Please don't post in MIME encoding. I have to manually decode the
mime to answer your question.
#include<stdio.h>

int main()
{
FILE *fp;

int i;
float f;
char str[20];

if( ( fp=fopen("stuff", "w")) == NULL )
{
printf("Sorry! Unable to create/read stuff");
exit(-1);
}

for( i=0; i<=10; i++ )
fprintf(fp, "%d:%s:%.2f\n", i, "Hello", 12.3f);

for( i=0; i<=5; i++)
{
fscanf( fp, "%d:%s:%.2f\n" , &i, &str, &f);

You have several problems here.

- you are trying to read from the end of a file
-------This was correct. I closed the file and opened it in read mode.
It's working.
- you have not flushed the output buffer
--------I'm not sure about this.
- you are trying to read from a file while it is in write mode; you
need to use rewind() or fseek() to switch to read mode

- you are printing out a ':' after the "Hello" and you are
expecting that when you fscanf() with %s format that that ':' will mark
the end of the "Hello" string. It will not, however: the %s format
reads to the next white-space. If you only want to read as far as
the next : then you need to use %[^:] as your format specifier.
----This is actual solution. I tried this and now it is reading the
string values upto ":"
Thank you for this Walter.
I have a problem reading the float values.
I modiifed my above code as:
.....
fclose(fp);
fp=NULL;
fp = fopen("stuff", "r") ;
for( i=0; i<=5; i++)
{
fscanf( fp, "%d:%[^:]s:%.2[^:]f\n" , &i, &str, &f);
printf("Hi %s %d %.2f Size:%d\n", str, i, f, strlen(str));
}
......

Can i Use [^:] to limit float values as above.
Now the output is:
Hi Hello 0 0.00 Size:5
Hi Hello 1 0.00 Size:5
Hi Hello 2 0.00 Size:5
Hi Hello 3 0.00 Size:5
Hi Hello 4 0.00 Size:5
Hi Hello 5 0.00 Size:5

Please tell me how to solve this new problem. Thanks in advance Walter.
-----------------------------------------------------------------------------------------------------
- you have not protected yourself in case the input string read into
str is larger than your buffer (20 including the \0 you want to
terminate the string)

- int main() should be int main(void)
printf("Hi %s %d %f\n", str, i, f);
}

fclose(fp);
return 0;
}
--
All is vanity. -- Ecclesiastes
Sep 14 '06 #20
In article <11*********************@e63g2000cwd.googlegroups. com>,
Rajen <ra*****@gmail.comwrote:
I have a problem reading the float values.
I modiifed my above code as:
....
fclose(fp);
fp=NULL;
fp = fopen("stuff", "r") ;
for( i=0; i<=5; i++)
{
fscanf( fp, "%d:%[^:]s:%.2[^:]f\n" , &i, &str, &f);
printf("Hi %s %d %.2f Size:%d\n", str, i, f, strlen(str));
}
>Can i Use [^:] to limit float values as above.
Now the output is:
Hi Hello 0 0.00 Size:5
Hi Hello 1 0.00 Size:5
Hi Hello 2 0.00 Size:5
Hi Hello 3 0.00 Size:5
Hi Hello 4 0.00 Size:5
Hi Hello 5 0.00 Size:5
>Please tell me how to solve this new problem. Thanks in advance Walter.
You do not need to use %[^:] or anything similar to limit reading
in float values: the parser will stop as soon as it encounters any
character which is not allowed in a float.

But your problem is not exactly where you were expecting. Your
new difficulty is in your fscanf() format where you have %[:]s

This does NOT mean:
"skip leading whitespace, then read a string of characters
until end of file or the next whitespace or a ':' is reached,
leaving the whitespace or ':' in the buffer"

What it *does* mean is:
"do NOT skip any leading whitespace; read a string of
characters (including whitespace) until end of file or a
':' is reached, leaving the ':' in the buffer; then once
that is done, look for the literal character 's' in the
input".

But since your input does not have a literal character 's'
at that point (and cannot have, since you are either at EOF
or at a ':'), the rest of the fscanf() fails, leaving all the
rest of the values to be read unchanged.

To be more clear about this: %[^:] is a format specifier
all by itself, introduced by the '%' (as all format
specifiers are), and with its type being indicated by the '['.
The format specification extends until the next non-escaped ']'
and ends there. Anything after that point is not part of that
format specifier. [^:] is NOT a modifier of a %s format specifier:
it is a format specifier all of its own, with different rules
than %s. For example, %s skips whitespace but %[] does not.
--
"No one has the right to destroy another person's belief by
demanding empirical evidence." -- Ann Landers
Sep 14 '06 #21
<OT: news format>
On Wed, 13 Sep 2006 22:45:13 +0000 (UTC), ro******@ibd.nrc-cnrc.gc.ca
(Walter Roberson) wrote:
<snip>
The original posting contained sample output of the program. That
sample output included non-ASCII characters. <snip>
The posting also contained incidental encodings of all the equal
signs (because they introduce quoted-printable characters), and
as well an encoding of a period that happened to occur at the
beginning of a line.
I didn't notice that one, so I went back and looked. It wasn't even at
the beginning of a line, which would be silly enough. It was the
_second_ position on a line, after a dollarsign. My bemusement at
google's craziness soars to even greater heights than before. Maybe
they think the news spool will somehow be used as perl scripts?

- David.Thompson1 at worldnet.att.net
Sep 21 '06 #22

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

Similar topics

2
by: WSeeger | last post by:
When creating a new class, is it encouraged to always include error handling routines within your LET and GET procedures? It's seems that most text books never seem to include much about error...
5
by: John Douglass | last post by:
I'm fairly new to doing involved file i/o and I came across something weird with a program I'm writing (modifying MIDI data, if it makes any difference). With some input files, when I modify data...
4
by: Tatu Portin | last post by:
Is there any convenient way to program text-handling routines in C? For example, I have a text file and I want to remove every other line, and then write the output. Or should I read tutorials...
4
by: BHARAT | last post by:
Hi I am a little bit new to C's advanced topics: I need help in file handling. I have Turbo C and I wrote a simple program to write data to file: #include<stdio.h> #include<dir.h>...
1
by: Rajen | last post by:
When I run this program: #include<stdio.h> int main() { FILE *fp; int i; float f; char str;
8
by: zdp | last post by:
Hello! I need to process some webpages of a forum which is powered by discuz!. When I login, there are some options about how long to keep the cookies: forever, month, week, et al. If I choose...
5
by: Sam | last post by:
Hi, I have one table like : MyTable {field1, field2, startdate, enddate} I want to have the count of field1 between startdate and enddate, and the count of field2 where field2 = 1 between...
2
by: charlesbritto | last post by:
A C++ program for counting individual string in a text file using file handling functions., for ex: if the text file contains, am a boy,am studying +2,am from chennai Now the result shoud...
5
by: kailashchandra | last post by:
I am trying to upload a file in php,but it gives me error msg please Help me? My Code is like below:- i have one php file named upload.php and i have another html file named upload.html and...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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,...

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.