473,581 Members | 2,497 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Write to file

Hello,

I'm trying to output buffer content to a file. I either get an access
violation error, or crazy looking output in the file depending on
which method I use to write the file. Can anyone help out a newbie?
#include <stdio.h>
#include <ctype.h>
#include <string.h>

#define DISPLAY 117 /* Length of display line */
#define PAGE_LENGTH 20 /* Lines per page */

int main(int argc, char *argv[])
{
FILE *pfile;
FILE *outfile;
char *p;

unsigned char buffer[DISPLAY/4 - 1]; /* File input buffer */
int count = 0; /* Count of characters in buffer */
int lines = 0; /* Number of lines displayed */
int i = 0; /* Loop counter */

char string [100];
pfile = fopen ("my.txt" , "r");

while(!feof(pfi le)) /* Continue until end of file */
{
if(count < sizeof buffer) /* If the buffer is not full */
/* Read a character */
buffer[count++] = (unsigned char)fgetc(pfil e);
else
{
/* Now display buffer contents as characters */
for(count = 0; count < sizeof buffer; count++)
printf("%c", isprint(buffer[count]) ? buffer[count]:'.');
printf("\n"); /* End the line */
count = 0; /* Reset count */

if(!(++lines%PA GE_LENGTH)) /* End of page? */
if(getchar()==' E') /* Wait for Enter */
return 0; /* E pressed */
}
}

/* Display last line as characters */
for(i = 0; i < count; i++)
{
printf("%c",isp rint(buffer[i]) ? buffer[i]:'.');
}

printf("\n");
fclose(pfile); /* Close the file */

//re-open file and write out the buffer contents
outfile = fopen ("myOutput.t xt" , "w");

if(outfile==NUL L)
{
return 0;
}

//causes an access violation error
for(count = 0; count < sizeof buffer; count++)
{
fputc(outfile, isprint(buffer[count]) ? buffer[count]:'.');
}

//causes crazy output in file
/*for(count = 0; count < sizeof buffer; count++)
{
(int) fwrite(buffer, 1, isprint(buffer[count]), outfile);
}*/

fclose(outfile) ;
getchar();
return 0;
}

Jun 13 '07 #1
24 4417
Bill <bi*********@al lstate.comwrite s:
Hello,

I'm trying to output buffer content to a file. I either get an access
violation error, or crazy looking output in the file depending on
which method I use to write the file. Can anyone help out a newbie?
Sure...
#include <stdio.h>
#include <ctype.h>
#include <string.h>

#define DISPLAY 117 /* Length of display line */
#define PAGE_LENGTH 20 /* Lines per page */

int main(int argc, char *argv[])
{
FILE *pfile;
FILE *outfile;
char *p;

unsigned char buffer[DISPLAY/4 - 1]; /* File input buffer */
int count = 0; /* Count of characters in buffer */
int lines = 0; /* Number of lines displayed */
int i = 0; /* Loop counter */

char string [100];
pfile = fopen ("my.txt" , "r");
You should check it worked. I know you know this!
while(!feof(pfi le)) /* Continue until end of file */
This will cause you some surprises and won't do what you think. You
should check the return from the read operation (in you case) fgetc:

int c;
....
while ((c = fgetc(pfile)) != EOF) {
...

The feof function only returns a non-zero value *after* an input
operation has failed due to and end-of-file condition. It should be
used only to tell *why* things have gone wrong.
{
if(count < sizeof buffer) /* If the buffer is not full */
/* Read a character */
buffer[count++] = (unsigned char)fgetc(pfil e);
else
{
/* Now display buffer contents as characters */
for(count = 0; count < sizeof buffer; count++)
printf("%c", isprint(buffer[count]) ? buffer[count]:'.');
printf("\n"); /* End the line */
count = 0; /* Reset count */

if(!(++lines%PA GE_LENGTH)) /* End of page? */
if(getchar()==' E') /* Wait for Enter */
return 0; /* E pressed */
There getchar calls will normally be working on a buffered input so it
is not a good way to "pause" your program. If I wanted to do this (and
for some reason I don't these days) I'd write a function to read a
whole line of input and decide what to do based on that.
}
}

/* Display last line as characters */
for(i = 0; i < count; i++)
{
printf("%c",isp rint(buffer[i]) ? buffer[i]:'.');
}

printf("\n");
fclose(pfile); /* Close the file */
You should check if this worked also.
//re-open file and write out the buffer contents
outfile = fopen ("myOutput.t xt" , "w");

if(outfile==NUL L)
{
return 0;
}

//causes an access violation error
for(count = 0; count < sizeof buffer; count++)
{
fputc(outfile, isprint(buffer[count]) ? buffer[count]:'.');
You should check that this worked. Get in the habit of checking
everything that there is to check!
}

//causes crazy output in file
/*for(count = 0; count < sizeof buffer; count++)
{
(int) fwrite(buffer, 1, isprint(buffer[count]), outfile);
}*/
This will repeatedly try to print the first character in buffer as
many times as there are printable characters in the buffer!. Also, by
using it this way (asking to write no data sometimes) you make error
checking much harder. Stick with the fputc method. It is fine. For
the record you probably intended:

fwrite(&buffer[count], 1, isprint(buffer[count]), outfile);

If you want to print a whole buffer. Process it first:

for (count = 0; count < sizeof buffer; count++)
if (!isprint(buffe r[count]))
buffer[count] = '.';

if (fwrite(buffer, 1, count, outfile) != count)
/* report a write error... */
>
fclose(outfile) ;
getchar();
return 0;
}
--
Ben.
Jun 13 '07 #2
On Jun 13, 6:09 am, Ben Bacarisse <ben.use...@bsb .me.ukwrote:
Bill <bill.war...@al lstate.comwrite s:
Hello,
I'm trying to output buffer content to a file. I either get an access
violation error, or crazy looking output in the file depending on
which method I use to write the file. Can anyone help out a newbie?

Sure...


#include <stdio.h>
#include <ctype.h>
#include <string.h>
#define DISPLAY 117 /* Length of display line */
#define PAGE_LENGTH 20 /* Lines per page */
int main(int argc, char *argv[])
{
FILE *pfile;
FILE *outfile;
char *p;
unsigned char buffer[DISPLAY/4 - 1]; /* File input buffer */
int count = 0; /* Count of characters in buffer */
int lines = 0; /* Number of lines displayed */
int i = 0; /* Loop counter */
char string [100];
pfile = fopen ("my.txt" , "r");

You should check it worked. I know you know this!
while(!feof(pfi le)) /* Continue until end of file */

This will cause you some surprises and won't do what you think. You
should check the return from the read operation (in you case) fgetc:

int c;
....
while ((c = fgetc(pfile)) != EOF) {
...

The feof function only returns a non-zero value *after* an input
operation has failed due to and end-of-file condition. It should be
used only to tell *why* things have gone wrong.
{
if(count < sizeof buffer) /* If the buffer is not full */
/* Read a character */
buffer[count++] = (unsigned char)fgetc(pfil e);
else
{
/* Now display buffer contents as characters */
for(count = 0; count < sizeof buffer; count++)
printf("%c", isprint(buffer[count]) ? buffer[count]:'.');
printf("\n"); /* End the line */
count = 0; /* Reset count */
if(!(++lines%PA GE_LENGTH)) /* End of page? */
if(getchar()==' E') /* Wait for Enter */
return 0; /* E pressed */

There getchar calls will normally be working on a buffered input so it
is not a good way to "pause" your program. If I wanted to do this (and
for some reason I don't these days) I'd write a function to read a
whole line of input and decide what to do based on that.
}
}
/* Display last line as characters */
for(i = 0; i < count; i++)
{
printf("%c",isp rint(buffer[i]) ? buffer[i]:'.');
}
printf("\n");
fclose(pfile); /* Close the file */

You should check if this worked also.
//re-open file and write out the buffer contents
outfile = fopen ("myOutput.t xt" , "w");
if(outfile==NUL L)
{
return 0;
}
//causes an access violation error
for(count = 0; count < sizeof buffer; count++)
{
fputc(outfile, isprint(buffer[count]) ? buffer[count]:'.');

You should check that this worked. Get in the habit of checking
everything that there is to check!
}
//causes crazy output in file
/*for(count = 0; count < sizeof buffer; count++)
{
(int) fwrite(buffer, 1, isprint(buffer[count]), outfile);
}*/

This will repeatedly try to print the first character in buffer as
many times as there are printable characters in the buffer!. Also, by
using it this way (asking to write no data sometimes) you make error
checking much harder. Stick with the fputc method. It is fine. For
the record you probably intended:

fwrite(&buffer[count], 1, isprint(buffer[count]), outfile);

If you want to print a whole buffer. Process it first:

for (count = 0; count < sizeof buffer; count++)
if (!isprint(buffe r[count]))
buffer[count] = '.';

if (fwrite(buffer, 1, count, outfile) != count)
/* report a write error... */
fclose(outfile) ;
getchar();
return 0;
}

--
Ben.- Hide quoted text -

- Show quoted text -
Thanks alot. I'm making progress. No errors now, but the output in
the file is screwy. The code:
#include <stdio.h>
#include <ctype.h>
#include <string.h>

#define DISPLAY 117 /* Length of display line */
#define PAGE_LENGTH 20 /* Lines per page */

int main(int argc, char *argv[])
{
FILE *pfile; /* File pointer */
FILE *outfile;
char *p;
int c;

unsigned char buffer[DISPLAY/4 - 1]; /* File input buffer */
int count = 0; /* Count of characters in buffer */
int lines = 0; /* Number of lines displayed */
int i = 0; /* Loop counter */

char string [100];
pfile = fopen ("my.txt" , "r");
while((c = fgetc(pfile)) != EOF) /* Continue until end of
file */
{
if(count < sizeof buffer) /* If the buffer is not full */
/* Read a character */
buffer[count++] = (unsigned char)fgetc(pfil e);
else
{
/* Now display buffer contents as characters */
for(count = 0; count < sizeof buffer; count++)
printf("%c", isprint(buffer[count]) ? buffer[count]:'.');
printf("\n"); /* End the line */
count = 0; /* Reset count */

if(!(++lines%PA GE_LENGTH)) /* End of page? */
if(getchar()==' E') /* Wait for Enter */
return 0; /* E pressed */
}
}

/* Display last line as characters */
for(i = 0; i < count; i++)
{
printf("%c",isp rint(buffer[i]) ? buffer[i]:'.');
}

printf("\n");
fclose(pfile); /* Close the file */

//re-open file and write out the buffer contents
outfile = fopen ("myOutput.t xt" , "w");

if(outfile==NUL L)
{
return 0;
}
for(count = 0; count < sizeof buffer; count++)
{
if(!isprint(buf fer[count]))
{
buffer[count] = '.';
}
else
{
fputc(buffer[count],outfile);
}
//fputc(outfile, isprint(buffer[count]) ? buffer[count]:'.');
}

/*for(count = 0; count < sizeof buffer; count++)
{
(int) fwrite(buffer, 1, isprint(buffer[count]), outfile);
}*/

fclose(outfile) ;
getchar();
return 0;
}

Input file contents:
Fred Flinstone 123-456-7890
Barney Rubble 123-789-4561

Output file:
B12y7p456r

Jun 13 '07 #3
Bill <bi*********@al lstate.comwrite s:
Thanks alot. I'm making progress. No errors now, but the output in
the file is screwy. The code:
Please trip your replies (and always trim signature lines).
#include <stdio.h>
#include <ctype.h>
#include <string.h>

#define DISPLAY 117 /* Length of display line */
#define PAGE_LENGTH 20 /* Lines per page */

int main(int argc, char *argv[])
{
FILE *pfile; /* File pointer */
FILE *outfile;
char *p;
int c;

unsigned char buffer[DISPLAY/4 - 1]; /* File input buffer */
int count = 0; /* Count of characters in buffer */
int lines = 0; /* Number of lines displayed */
int i = 0; /* Loop counter */

char string [100];
pfile = fopen ("my.txt" , "r");
while((c = fgetc(pfile)) != EOF) /* Continue until end of
file */
{
if(count < sizeof buffer) /* If the buffer is not full */
/* Read a character */
buffer[count++] = (unsigned char)fgetc(pfil e);
I intended you you use c here not read another character!
else
{
/* Now display buffer contents as characters */
for(count = 0; count < sizeof buffer; count++)
printf("%c", isprint(buffer[count]) ? buffer[count]:'.');
printf("\n"); /* End the line */
count = 0; /* Reset count */
Your input is long enough to trigger this condition. You reuse the buffer.
if(!(++lines%PA GE_LENGTH)) /* End of page? */
if(getchar()==' E') /* Wait for Enter */
return 0; /* E pressed */
}
}

/* Display last line as characters */
for(i = 0; i < count; i++)
{
printf("%c",isp rint(buffer[i]) ? buffer[i]:'.');
}

printf("\n");
fclose(pfile); /* Close the file */

//re-open file and write out the buffer contents
outfile = fopen ("myOutput.t xt" , "w");

if(outfile==NUL L)
{
return 0;
}
for(count = 0; count < sizeof buffer; count++)
{
if(!isprint(buf fer[count]))
{
buffer[count] = '.';
}
else
{
fputc(buffer[count],outfile);
}
You took a suggestion to modify the buffer and combined it with single
character printing to produce something rather odd. It is not wrong,
just odd. Why change buffer[count] when is it not a printing
character if you don't then print it?
//fputc(outfile, isprint(buffer[count]) ? buffer[count]:'.');
}

/*for(count = 0; count < sizeof buffer; count++)
{
(int) fwrite(buffer, 1, isprint(buffer[count]), outfile);
}*/

fclose(outfile) ;
getchar();
return 0;
}

Input file contents:
Fred Flinstone 123-456-7890
Barney Rubble 123-789-4561

Output file:
B12y7p456r
Not what I get, but still.

I should point out that although I have only commented on details, the
overall design of this program looks a bit wacky. If you intend to
process text files, why do you have a buffer of size 117/4-1? Why are
you happy to simply reuse the space when you read more than these 28
characters? If the input has 30 characters, your buffer will contain
numbers 29 and 30 followed by character numbers 3, 4 and so on. It
all looks very odd.

You should maybe say what you are actually trying to do.

--
Ben.
Jun 13 '07 #4
On Jun 13, 7:40 am, Ben Bacarisse <ben.use...@bsb .me.ukwrote:
Bill <bill.war...@al lstate.comwrite s:
Thanks alot. I'm making progress. No errors now, but the output in
the file is screwy. The code:

Please trip your replies (and always trim signature lines).


#include <stdio.h>
#include <ctype.h>
#include <string.h>
#define DISPLAY 117 /* Length of display line */
#define PAGE_LENGTH 20 /* Lines per page */
int main(int argc, char *argv[])
{
FILE *pfile; /* File pointer */
FILE *outfile;
char *p;
int c;
unsigned char buffer[DISPLAY/4 - 1]; /* File input buffer */
int count = 0; /* Count of characters in buffer */
int lines = 0; /* Number of lines displayed */
int i = 0; /* Loop counter */
char string [100];
pfile = fopen ("my.txt" , "r");
while((c = fgetc(pfile)) != EOF) /* Continue until end of
file */
{
if(count < sizeof buffer) /* If the buffer is not full */
/* Read a character */
buffer[count++] = (unsigned char)fgetc(pfil e);

I intended you you use c here not read another character!
else
{
/* Now display buffer contents as characters */
for(count = 0; count < sizeof buffer; count++)
printf("%c", isprint(buffer[count]) ? buffer[count]:'.');
printf("\n"); /* End the line */
count = 0; /* Reset count */

Your input is long enough to trigger this condition. You reuse the buffer.


if(!(++lines%PA GE_LENGTH)) /* End of page? */
if(getchar()==' E') /* Wait for Enter */
return 0; /* E pressed */
}
}
/* Display last line as characters */
for(i = 0; i < count; i++)
{
printf("%c",isp rint(buffer[i]) ? buffer[i]:'.');
}
printf("\n");
fclose(pfile); /* Close the file */
//re-open file and write out the buffer contents
outfile = fopen ("myOutput.t xt" , "w");
if(outfile==NUL L)
{
return 0;
}
for(count = 0; count < sizeof buffer; count++)
{
if(!isprint(buf fer[count]))
{
buffer[count] = '.';
}
else
{
fputc(buffer[count],outfile);
}

You took a suggestion to modify the buffer and combined it with single
character printing to produce something rather odd. It is not wrong,
just odd. Why change buffer[count] when is it not a printing
character if you don't then print it?


//fputc(outfile, isprint(buffer[count]) ? buffer[count]:'.');
}
/*for(count = 0; count < sizeof buffer; count++)
{
(int) fwrite(buffer, 1, isprint(buffer[count]), outfile);
}*/
fclose(outfile) ;
getchar();
return 0;
}
Input file contents:
Fred Flinstone 123-456-7890
Barney Rubble 123-789-4561
Output file:
B12y7p456r

Not what I get, but still.

I should point out that although I have only commented on details, the
overall design of this program looks a bit wacky. If you intend to
process text files, why do you have a buffer of size 117/4-1? Why are
you happy to simply reuse the space when you read more than these 28
characters? If the input has 30 characters, your buffer will contain
numbers 29 and 30 followed by character numbers 3, 4 and so on. It
all looks very odd.

You should maybe say what you are actually trying to do.

--
Ben.- Hide quoted text -

- Show quoted text -- Hide quoted text -

- Show quoted text -- Hide quoted text -

- Show quoted text -
Yes. It has become wacky. What I'm trying to do is read the contents
of a file into a buffer, find a particular string in the buffer, make
an edit in the found string and write the same file back out.

Jun 13 '07 #5
Bill <bi*********@al lstate.comwrite s:
On Jun 13, 7:40 am, Ben Bacarisse <ben.use...@bsb .me.ukwrote:
>You should maybe say what you are actually trying to do.

Yes. It has become wacky. What I'm trying to do is read the contents
of a file into a buffer, find a particular string in the buffer, make
an edit in the found string and write the same file back out.
Ah, well... that could be done much more simply. Presumably this is some
class assignment or you would simply use one of the many fine tools
that can do this?

You did not take my advice to trim your replies (you quoted everything
including my signature block). That will have won you no favours from
others here and it discourages me from helping further.

--
Ben.
Jun 13 '07 #6
>
You did not take my advice to trim your replies (you quoted everything
including my signature block). That will have won you no favours from
others here and it discourages me from helping further.
Sorry. Yes it is an assignment, but I'm trying to take it further
than what was assigned.
I really wish to learn the language.
Jun 13 '07 #7
On 13 Jun, 13:04, Bill <bill.war...@al lstate.comwrote :
>
Thanks alot. I'm making progress. No errors now, but the output in
the file is screwy. The code:

#include <stdio.h>
#include <ctype.h>
#include <string.h>

#define DISPLAY 117 /* Length of display line */
#define PAGE_LENGTH 20 /* Lines per page */

int main(int argc, char *argv[])
{
FILE *pfile; /* File pointer */
FILE *outfile;
char *p;
int c;

unsigned char buffer[DISPLAY/4 - 1]; /* File input buffer */
Initialising this would be advisable, given what you're going to do
with it later.
int count = 0; /* Count of characters in buffer */
int lines = 0; /* Number of lines displayed */
int i = 0; /* Loop counter */

char string [100];
pfile = fopen ("my.txt" , "r");

while((c = fgetc(pfile)) != EOF) /* Continue until end of
file */
{
if(count < sizeof buffer) /* If the buffer is not full */
/* Read a character */
buffer[count++] = (unsigned char)fgetc(pfil e);
This needs to be changed to :
buffer[count++] = (unsigned char)c;

As otherwise you are reading the first character in the while loop and
then ignoring it and reading a second character here. This is why you
get every other character in the output.

else
{
/* Now display buffer contents as characters */
for(count = 0; count < sizeof buffer; count++)
printf("%c", isprint(buffer[count]) ? buffer[count]:'.');
printf("\n"); /* End the line */
count = 0; /* Reset count */
This is what's causing your output file to look a bit odd. Once you've
read the input up to a full buffer, you just print it to screen and
then re-start at the beginning of the buffer. This data never (except
for the last couple of rows, by chance) goes to the datafile and so
you don't get everything that you're after. So you either need to
output it here or store it somehow.
>
if(!(++lines%PA GE_LENGTH)) /* End of page? */
if(getchar()==' E') /* Wait for Enter */
return 0; /* E pressed */
}
}

/* Display last line as characters */
for(i = 0; i < count; i++)
{
printf("%c",isp rint(buffer[i]) ? buffer[i]:'.');
}

printf("\n");
fclose(pfile); /* Close the file */

//re-open file and write out the buffer contents
outfile = fopen ("myOutput.t xt" , "w");

if(outfile==NUL L)
{
return 0;
}

for(count = 0; count < sizeof buffer; count++)
You also don't know that all of buffer has been filled. It's not
initialised so it could well be causing undefince behaviour here. You
either need to keep a count of how many characters you've read or need
to initialise the array and/or populate and look for '\0' characters
at read time.

Given what you're trying to do I would suggest you take a look at the
fgets function.
{
if(!isprint(buf fer[count]))
{
buffer[count] = '.';
}
else
{
fputc(buffer[count],outfile);
}

And this lot doesn't need to be in an else, it needs to happen every
time.

<snip rest of code>
Jun 13 '07 #8
Bill <bi*********@al lstate.comwrite s:
>>
You did not take my advice to trim your replies (you quoted everything
including my signature block). That will have won you no favours from
others here and it discourages me from helping further.

Sorry.
Well you get much credit for *not* digging in and arguing that your
way of posting is the right way. Thank you.
Yes it is an assignment, but I'm trying to take it further
than what was assigned.
I really wish to learn the language.
A simple solution, which will concentrate on the language features
rather than on getting the searching algorithm right, is to:

(1) Find out how big the file is. There are two ways to do this in
standard C, but only one that is guaranteed to work. If I were your
tutor I would accept both, provided your program reports any failures
as such.

(2) Allocate space for the whole file and read it in.

(3) Search for the string to replace whilst writing out those parts
that are not to be replaced.

There are obvious limitations with this strategy, but it will help you
learn. A fully general search and replace program is quite complex
for a beginner.

--
Ben.
Jun 13 '07 #9
There are obvious limitations with this strategy, but it will help you
learn. A fully general search and replace program is quite complex
for a beginner.

--
Ben.
Thanks for the tips.

Jun 13 '07 #10

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

Similar topics

1
7377
by: Ellixis | last post by:
Hello, How can I use fwrite() and fseek() in order to write data in the middle (or anywhere else) of a file without overwriting existing data ? People told me that I should load the file into memory (a variable) and use concatenation. But, according to me, It isn't clean to load an entire file into
5
2251
by: Just Me | last post by:
Using streams how do I write and then read a set of variables? For example, suppose I want to write into a text file: string1,string2,string3 Then read them later. Suppose I want to write and then read: string1, integer1, double1
6
9211
by: sambuela | last post by:
How can I write message to the file located in the wwwroot directory? It seems that IIS protect these files. Let make me cannot do the I/O writing sucessfully. I try to open file's write privileage by file manager and IIS manager. However, one PC is okay and another PC is not. Any help on this will be greatly appreciated. Regards,...
2
4898
by: ykgoh | last post by:
Hi. I've a problem of being able to create and remove a directory but unable to write a file inside the created directory for some strange reason. I suspect that this problem could be vaguely linked to Safe mode being set to On since my site is using shared server hosting and probably insufficient/incorrect Unix file permission. Below is...
5
3651
by: philip | last post by:
Here is some lines of code than I wrote. You can copy/paste theis code as code of form1 in a new project. My problem is this one : I try to write in a file a serie of bytes. BUT some bytes written in file are not the sent bytes. Copy and paste the following lines to observe my problem. What can I do to resolve problem ? Only...
1
8054
by: =?Utf-8?B?R2FuZXNoIE11dGh1dmVsdQ==?= | last post by:
Hello All, Our application write logs to a file in a folder. Before our application starts writing to that file, I want to check if the current user has write access to that file, for example, "c:\temp\LogFile.txt". I see several articles for setting file access permissions, getting file access permissions for a given user or current user -...
0
789
by: Buddy Home | last post by:
Hello, I'm trying to upload a file programatically and occasionally I get the following error message. Unable to write data to the transport connection: An established connection was aborted by the software in your host machine. Stack Trace at System.Net.Sockets.NetworkStream.Write(Byte buffer, Int32 offset, Int32
3
14044
by: Buddy Home | last post by:
Hello, I'm trying to upload a file programatically and occasionally I get the following error message. Unable to write data to the transport connection: An established connection was aborted by the software in your host machine. Stack Trace at System.Net.Sockets.NetworkStream.Write(Byte buffer, Int32 offset, Int32
6
18292
by: globalrev | last post by:
i ahve a program that takes certain textsnippets out of one file and inserts them into another. problem is it jsut overwrites the first riow every time. i want to insert every new piece of text into the next row. so: 1. how do i write to a new line every time i write to the file? 2. if i dont want to write to a new line but just want...
0
7792
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8149
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. ...
0
8304
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...
1
7899
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...
0
8175
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6553
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5674
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...
0
5364
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...
1
1403
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.