473,569 Members | 2,584 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

problem with seekg

Hi,
I am having problems with a function that I have been using in my program to
read sentences from a 'command file' and parse them into commands. the
surprising thing is that the program works fine on some computers and not so
fine on others. I tried debugging and cannot make any sense of it. I
narrowed it down to the seekg function and made this simple program which
(from what I understand) does not seem to be working as expected in all the
computers I have tried so far.
please let me know if I have got something wrong...

#include <iostream>
#include <fstream>
using namespace std;

int _tmain(int argc, _TCHAR* argv[])
{
ifstream is("test.txt") ;
char test[256];
is >test;
cout << test << endl;
is.seekg(-2,ios::cur);
is >test;
cout << test << endl;
return 0;
}

here are the different versions of test.txt and their corresponding outputs
in all the cases I expected that the output would be
createModel
el
what am I doing wrong ?

case 1: contents of test.txt :
createModel

OUTPUT:
createModel
del

case 2: contents of test.txt
createModel
testing
/*
*/
OUTPUT:
createModel
eModel

case 3: contents of test.txt :
createModel
testing
/*
*/
CreateElements
196
DMElasticElemen t
0 195 1
-1
exitCreateEleme nts

OUTPUT:
createModel

thanks
Julian.
Mar 28 '07 #1
12 3385
Julian wrote:
Hi,
I am having problems with a function that I have been using in my program to
read sentences from a 'command file' and parse them into commands. the
surprising thing is that the program works fine on some computers and not so
fine on others. I tried debugging and cannot make any sense of it. I
narrowed it down to the seekg function and made this simple program which
(from what I understand) does not seem to be working as expected in all the
computers I have tried so far.
please let me know if I have got something wrong...

#include <iostream>
#include <fstream>
using namespace std;

int _tmain(int argc, _TCHAR* argv[])
{
ifstream is("test.txt") ;
char test[256];
test[0] = 0;
is >test;
cout << test << endl;
is.seekg(-2,ios::cur);
test[0] = 0;
is >test;
cout << test << endl;
return 0;
}

here are the different versions of test.txt and their corresponding outputs
in all the cases I expected that the output would be
createModel
el
what am I doing wrong ?

case 1: contents of test.txt :
createModel

OUTPUT:
createModel
del

case 2: contents of test.txt
createModel
testing
/*
*/
OUTPUT:
createModel
eModel

case 3: contents of test.txt :
createModel
testing
/*
*/
CreateElements
196
DMElasticElemen t
0 195 1
-1
exitCreateEleme nts

OUTPUT:
createModel

thanks
Julian.

Remember to account for the (invisible)
newline chars at the end of each line when
seeking backwards ("\r\n" on Windows, "\n"
on unix/linux, "\r" on Mac(?) ).

If 'test.txt' has just one line, it must end with a newline;
otherwise the result is not as expected. e.g. for Windows:

createModel\r\n
Mar 28 '07 #2
c
"Larry Smith" <ls****@nospam. comwrote in message
news:yzCOh.2681 0$xE.11979@trnd dc08...
Julian wrote:
>Hi,
I am having problems with a function that I have been using in my program
to
read sentences from a 'command file' and parse them into commands. the
surprising thing is that the program works fine on some computers and not
so
fine on others. I tried debugging and cannot make any sense of it. I
narrowed it down to the seekg function and made this simple program which
(from what I understand) does not seem to be working as expected in all
the
computers I have tried so far.
please let me know if I have got something wrong...

#include <iostream>
#include <fstream>
using namespace std;

int _tmain(int argc, _TCHAR* argv[])
{
ifstream is("test.txt") ;
char test[256];

test[0] = 0;
>is >test;
cout << test << endl;
is.seekg(-2,ios::cur);

test[0] = 0;
>is >test;
cout << test << endl;
return 0;
}

here are the different versions of test.txt and their corresponding
outputs
in all the cases I expected that the output would be
createModel
el
what am I doing wrong ?

case 1: contents of test.txt :
createModel

OUTPUT:
createModel
del

case 2: contents of test.txt
createModel
testing
/*
*/
OUTPUT:
createModel
eModel

case 3: contents of test.txt :
createModel
testing
/*
*/
CreateElemen ts
196
DMElasticEleme nt
0 195 1
-1
exitCreateElem ents

OUTPUT:
createModel

thanks
Julian.


Remember to account for the (invisible)
newline chars at the end of each line when
seeking backwards ("\r\n" on Windows, "\n"
on unix/linux, "\r" on Mac(?) ).

If 'test.txt' has just one line, it must end with a newline;
otherwise the result is not as expected. e.g. for Windows:

createModel\r\n
thanks for the reply... but I'm not sure if that explains everything. even
if I need to account for the invisible characters, the results don't make
sense... I tried all kinds of combinations.. but it seems like it is seeking
more than 2 offsets although I have just asked to offset 2. if I account for
the invisible characters, it should effectively offset only 1 visible
character... instead it is offsetting 3

another problem: why does the result change with the number of lines in the
file? ... even though I am only reading the first line!
the more number of lines I have, the more it is offsetting.

Mar 29 '07 #3
Julian wrote:
c
"Larry Smith" <ls****@nospam. comwrote in message
news:yzCOh.2681 0$xE.11979@trnd dc08...
>Julian wrote:
>>Hi,
I am having problems with a function that I have been using in my program
to
read sentences from a 'command file' and parse them into commands. the
surprising thing is that the program works fine on some computers and not
so
fine on others. I tried debugging and cannot make any sense of it. I
narrowed it down to the seekg function and made this simple program which
(from what I understand) does not seem to be working as expected in all
the
computers I have tried so far.
please let me know if I have got something wrong...

#include <iostream>
#include <fstream>
using namespace std;

int _tmain(int argc, _TCHAR* argv[])
{
ifstream is("test.txt") ;
char test[256];
test[0] = 0;
>>is >test;
cout << test << endl;
is.seekg(-2,ios::cur);
test[0] = 0;
>>is >test;
cout << test << endl;
return 0;
}

here are the different versions of test.txt and their corresponding
outputs
in all the cases I expected that the output would be
createModel
el
what am I doing wrong ?

case 1: contents of test.txt :
createModel

OUTPUT:
createModel
del

case 2: contents of test.txt
createModel
testing
/*
*/
OUTPUT:
createModel
eModel

case 3: contents of test.txt :
createModel
testing
/*
*/
CreateElement s
196
DMElasticElem ent
0 195 1
-1
exitCreateEle ments

OUTPUT:
createModel

thanks
Julian.

Remember to account for the (invisible)
newline chars at the end of each line when
seeking backwards ("\r\n" on Windows, "\n"
on unix/linux, "\r" on Mac(?) ).

If 'test.txt' has just one line, it must end with a newline;
otherwise the result is not as expected. e.g. for Windows:

createModel\r\n

thanks for the reply... but I'm not sure if that explains everything. even
if I need to account for the invisible characters, the results don't make
sense... I tried all kinds of combinations.. but it seems like it is seeking
more than 2 offsets although I have just asked to offset 2. if I account for
the invisible characters, it should effectively offset only 1 visible
character... instead it is offsetting 3

another problem: why does the result change with the number of lines in the
file? ... even though I am only reading the first line!
the more number of lines I have, the more it is offsetting.
I don't know.

It worked fine for me once I added the two "test[0] = 0;"
lines to the code. I tested it with all three versions
of your example test.txt files (on SUSE Linux 10.0 with
the GCC g++ compiler v4.0.2). With all three versions
of your test.txt, the output was:

createModel
el

You are using the non-Standard "_tmain()" and "_TCHAR".
Is this a Borland compiler? You might ask in a
newsgroup specific to your compiler.

Here's the code I compiled (it's slightly modified
from your original):

// julian.cpp - compile with: g++ -o julian julian.cpp
#include <iostream>
#include <fstream>
using namespace std;

int main(int argc, char * argv[])
{
char test[256];

ifstream is("test.txt") ;

test[0] = 0;
is >test;
cout << test << endl;

is.seekg(-2, ios::cur);
test[0] = 0;
is >test;
cout << test << endl;

return 0;
}
Mar 29 '07 #4
On Mar 28, 9:21 pm, "Julian" <jul...@nospamt amu.eduwrote:
I am having problems with a function that I have been using in my programto
read sentences from a 'command file' and parse them into commands. the
surprising thing is that the program works fine on some computers and notso
fine on others. I tried debugging and cannot make any sense of it. I
narrowed it down to the seekg function and made this simple program which
(from what I understand) does not seem to be working as expected in all the
computers I have tried so far.
please let me know if I have got something wrong...
#include <iostream>
#include <fstream>
Officially, you also need to include <istream>.
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
This line doesn't compile on my systems. What's _TCHAR? (For
that matter, what's _tmain? I would have expected main here,
and in fact, must use main if I don't want an error at link
time.)
{
ifstream is("test.txt") ;
char test[256];
is >test;
cout << test << endl;
is.seekg(-2,ios::cur);
The above line is undefined behavior. In a file opened in text
mode (as yours is), you are only allowed to seek to the
beginning, to the current position, or to a position returned
from a previous call to is.tell.
is >test;
cout << test << endl;
return 0;
}
here are the different versions of test.txt and their corresponding outputs
in all the cases I expected that the output would be
createModel
el
About the only way to reliably get this effect is to read
character by character, doing an is.tellg() after each
character.
what am I doing wrong ?
Trying to use direct positioning in a text file.

Generally speaking, they don't call them streams for nothing;
you can get away with some direct positionning in a binary file,
and you can place a "bookmark" to go back to in a text file, but
globally, they are designed for streamed input, i.e. sequential
access. You speak of parsing: all of the parsing technologies I
know are designed to work with sequential input, so I'm not sure
why you want to seek.

If worse comes to worse, read large chunks (or all) of your file
into memory, and use random access there. If you're not afraid
of system dependant issues, you might even consider memory
mapping the file. (Note that in a memory mapped file, you will
see the system specific line terminators.)

--
James Kanze (GABI Software) email:ja******* **@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientier ter Datenverarbeitu ng
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34

Mar 29 '07 #5
I don't know.
>
It worked fine for me once I added the two "test[0] = 0;"
lines to the code. I tested it with all three versions
of your example test.txt files (on SUSE Linux 10.0 with
the GCC g++ compiler v4.0.2). With all three versions
of your test.txt, the output was:

createModel
el

You are using the non-Standard "_tmain()" and "_TCHAR".
Is this a Borland compiler? You might ask in a
newsgroup specific to your compiler.

Here's the code I compiled (it's slightly modified
from your original):

// julian.cpp - compile with: g++ -o julian julian.cpp
#include <iostream>
#include <fstream>
using namespace std;

int main(int argc, char * argv[])
{
char test[256];

ifstream is("test.txt") ;

test[0] = 0;
is >test;
cout << test << endl;

is.seekg(-2, ios::cur);
test[0] = 0;
is >test;
cout << test << endl;

return 0;
}
I kinda got it figured out... and you were right, it had something to do
with the 'invisible' characters. though I don't know all the details behind
this.. maybe you can help.
I have been using this free program called notepad++ as a text editor. when
I hit the enter key after a line, it puts in a 'LF' character (found that
when I used the 'view all characters' option)
now when I open this file using windows notepad, all the individual lines
are combined into one line. and there is a weird character at the end of
each 'individual' line where it should have gone to a new line. once I got
rid of those characters and put in an actual enter key using notpad,
everything worked as expected.
I don't know how the files got corrupted like that... or why notepad++ is
putting just the 'LF' instead of a 'CR''LF'
seems like, in windows, if you do just an 'LF', it screws up everything.
maybe you can explain this or point me to some webpage that explains this ?

thanks,
Julian.
Mar 29 '07 #6
Julian <ju****@nospamt amu.eduwrote:
I kinda got it figured out... and you were right, it had something to do
with the 'invisible' characters. though I don't know all the details behind
this.. maybe you can help.
I have been using this free program called notepad++ as a text editor. when
I hit the enter key after a line, it puts in a 'LF' character (found that
when I used the 'view all characters' option)
now when I open this file using windows notepad, all the individual lines
are combined into one line. and there is a weird character at the end of
each 'individual' line where it should have gone to a new line. once I got
rid of those characters and put in an actual enter key using notpad,
everything worked as expected.
I don't know how the files got corrupted like that... or why notepad++ is
putting just the 'LF' instead of a 'CR''LF'
seems like, in windows, if you do just an 'LF', it screws up everything.
maybe you can explain this or point me to some webpage that explains this ?
I've never used notepad++, but it seems like it is saving files in Unix
mode instead of Windows mode. Look around in the options and see if you
can find anything relating to that. I know Vim is able to read and
write both formats, and you can change which mode it is using
on-the-fly.

Getting back on topic, read James Kanze's post. You are not really
supposed to be seeking on text files.

--
Marcus Kwok
Replace 'invalid' with 'net' to reply
Mar 29 '07 #7
I've never used notepad++, but it seems like it is saving files in Unix
mode instead of Windows mode. Look around in the options and see if you
can find anything relating to that. I know Vim is able to read and
write both formats, and you can change which mode it is using
on-the-fly.

Getting back on topic, read James Kanze's post. You are not really
supposed to be seeking on text files.

--
Marcus Kwok
Replace 'invalid' with 'net' to reply
thanks... I created a fresh file with notepad++ and it uses CRLF... i think
if the file being edited has LF in the first place, then it continues to use
CRLF
i move files back and forth from my school's supercomputer, so maybe thats
how its got messed up.

I will be responding to James Kanze's post... I should probably move to some
other method of parsing the files.

Julian.
Mar 29 '07 #8
Thank you very much for your reply. I don't consider myself to be a very
experienced c++ programmer so forgive me if the questions seem
mundane/trivial
Officially, you also need to include <istream>.
do you mean just for correctness ? because I see that istream is a base
class for iostream.. or is there some other reason for explicitly including
istream
This line doesn't compile on my systems. What's _TCHAR? (For
that matter, what's _tmain? I would have expected main here,
and in fact, must use main if I don't want an error at link
time.)

I'm sorry about that... I just created a default win32 console project
using VS2005 and thats what it gave me. I'm really not sure whats the reason
for all that either, but i think it somehow converts to the typical main()
The above line is undefined behavior. In a file opened in text
mode (as yours is), you are only allowed to seek to the
beginning, to the current position, or to a position returned
from a previous call to is.tell.

can you tell me where is the most updated (or correct) documentation for
these functions? because all the places that I looked -basically MSDN and
google search results - do not mention this thing about seeking undefined
for text mode.

if you read my other post, you'll see that the problem was with 'LF'
characters in the text file.
Trying to use direct positioning in a text file.
Generally speaking, they don't call them streams for nothing;
you can get away with some direct positionning in a binary file,
and you can place a "bookmark" to go back to in a text file, but
globally, they are designed for streamed input, i.e. sequential
access. You speak of parsing: all of the parsing technologies I
know are designed to work with sequential input, so I'm not sure
why you want to seek.
>If worse comes to worse, read large chunks (or all) of your file
into memory, and use random access there. If you're not afraid
of system dependant issues, you might even consider memory
mapping the file. (Note that in a memory mapped file, you will
see the system specific line terminators.)

I have been using this legacy code that was written by one of my
predecessors... and its probably outdated (or the wrong) way to do things.
I am all for moving to a more commonly used (and free) parsing
technology...bu t I don't know where to start. I tried looking up parsing in
google once but I was overwhelmed by what was out there. I need to be able
to read a text file that contains strings and numbers... but ignore c-style
comments like '//' and '/*' and '*/'
Is there any easy to use parsing utility that can do that for me (in both
windows and unix) ?

thanks a lot for your help,
Julian.

--
James Kanze (GABI Software) email:ja******* **@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientier ter Datenverarbeitu ng
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34
Mar 29 '07 #9
On Mar 30, 1:19 am, "Julian" <jul...@nospamt amu.eduwrote:
Thank you very much for your reply. I don't consider myself to be a very
experienced c++ programmer so forgive me if the questions seem
mundane/trivial
Officially, you also need to include <istream>.
do you mean just for correctness ? because I see that istream is a base
class for iostream.. or is there some other reason for explicitly including
istream
Because the standard says so:-).

Officially, <iostreamis not required to define any class. It
is only required to provide external declarations (not
definitions) of the standard iostream objects (e.g. std::cout,
etc.). And you don't need a class definition to provide a
declaration. I'll spare you the real requirements, because they
are extremely (and IMHO unnecessarily) complicated, but it comes
out to roughly the equivalent of:

namespace std {
class ostream ;
class istream ;

extern istream cin ;
extern ostream cout ;
// ... same thing for all of the other objects,
// plus for the wide character classes and objects...
}

For convenience, all of the actual implementations of <iostream>
that I know of start by including <istreamand <ostream>.
People have gotten used to this, many books (including some very
good ones) omit the include of <ostream>, etc., so in practice,
I doubt that you have to worry about it.
This line doesn't compile on my systems. What's _TCHAR? (For
that matter, what's _tmain? I would have expected main here,
and in fact, must use main if I don't want an error at link
time.)
I'm sorry about that... I just created a default win32 console project
using VS2005 and thats what it gave me. I'm really not sure whats the reason
for all that either, but i think it somehow converts to the typical main()
That's what I suspect as well, but since I don't normally have
access to a Windows machine...
The above line is undefined behavior. In a file opened in text
mode (as yours is), you are only allowed to seek to the
beginning, to the current position, or to a position returned
from a previous call to is.tell.
can you tell me where is the most updated (or correct) documentation for
these functions? because all the places that I looked -basically MSDN and
google search results - do not mention this thing about seeking undefined
for text mode.
The official documentation would be the ISO standard for C++.
In this case, however, it refers to the C standard---everything
is "as if" such and such a C library function were used on a
FILE*. Which isn't necessarily a bad thing, since the C
standard is somewhat less unreadable than the C++ one:-).

With regards as to where you should look for such information,
I'm not sure what to tell you. I was tracking the ANSI
C standard for a customer when it was being written, and writing
a C standard library for them, so I got in on the ground floor,
so to speak. I don't think that trying to read the standard is
a good way to learn.

I would hope that any text which teaches C++ IO would discuss
the issues, but apparently, yours didn't. And given my
background, I've not had the occasion to read such texts myself.
(I have copies of the C and the C++ standards, and the latest
draft for the next version of the C++ standard, on line, and
consult them when I'm unsure of anything. But IMHO, unless you
already have a very good idea about is available and allowed,
they wouldn't be of much use.)
if you read my other post, you'll see that the problem was with 'LF'
characters in the text file.
And, presumably, certain implementations accepting them as end
of lines, and others not.

Note that this is a difficult problem in general. The Windows
convention is to use the two character sequence 0x0D,0x0A as an
end of line indicator. The Unix convention is a single 0x0A,
the traditional Mac convention a 0x0D, and most mainframes don't
use any character at all; the information is stored in the file
format. All of which wouldn't cause too many problems, except
that the C committee decided that within C, the Unix convention
would prevail, so some remapping is necessary at the interface
(and we get the distinction between text and binary files), and
of course the fact that today, thanks to the network, files
written on one system are being read on another, so you can't
really count on the file following the local conventions. IMHO,
a good implementation will handle the Windows, Unix and Mac
conventions transparently on input, and output according to the
native conventions, but I've also had various problems because
of inconsistencies .

The fact that some "char" might in fact be represented by a
varying number of bytes in the physical file is why there are
so many restrictions on where you can position to in text mode.
Note that the problem will become more difficult, not less, as
time goes on---UTF-8 is rapidly becoming a standard 8 bit code,
and with UTF-8, of course, the number of bytes in a single
character can vary from 1 to 6.
Trying to use direct positioning in a text file. Generally
speaking, they don't call them streams for nothing; you can
get away with some direct positionning in a binary file, and
you can place a "bookmark" to go back to in a text file, but
globally, they are designed for streamed input, i.e.
sequential access. You speak of parsing: all of the parsing
technologies I know are designed to work with sequential
input, so I'm not sure why you want to seek.
If worse comes to worse, read large chunks (or all) of your
file into memory, and use random access there. If you're
not afraid of system dependant issues, you might even
consider memory mapping the file. (Note that in a memory
mapped file, you will see the system specific line
terminators.)
I have been using this legacy code that was written by one of my
predecessors... and its probably outdated (or the wrong) way to do things.
I am all for moving to a more commonly used (and free) parsing
technology...bu t I don't know where to start. I tried looking up parsing in
google once but I was overwhelmed by what was out there. I need to be able
to read a text file that contains strings and numbers... but ignore c-style
comments like '//' and '/*' and '*/'
Is there any easy to use parsing utility that can do that for me (in both
windows and unix) ?
Well, I tend to use lex (or flex) a lot. (Technically speaking,
I think your problem involves tokenizing, which is generally
viewed as a preliminary step to parsing.) Flex is available for
most platforms, although I don't know how you'ld go about
integrating it into your builds if you use Visual Studio. (I
use GNU make everywhere, including with VC++ under Windows.) It
also generally takes a bit of hacking to make it work with C++.
You might want to have a look at the sources to my executable
kloc (http://kanze.james.neuf.fr/code/Exec/kloc/kloc.l); you
certainly won't be able to use it directly, but it should give
you some ideas about one way to handle comments directly in
flex.

Depending on the syntax, and the size of the files, you might be
able to either process the file line by line, or even the entire
file at once. Once you have a block of text in memory, of
course, random positionning, backing up, etc. is no problem.
And you can use tools like boost::regex on the in memory data.

If you don't want to rewrite everything, you might also try
reading the file as binary, and handling the new line
conventions yourself---it isn't that hard to treat \n, \r and
the two character sequence "\r\n" in an identical fashion.
(There will still be problems, of course, if you move to UTF-8
input, with accented or non-Latin characters, but this may not
be an issue for you.)

--
James Kanze (GABI Software) email:ja******* **@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientier ter Datenverarbeitu ng
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34

Mar 30 '07 #10

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

Similar topics

3
13366
by: Kapil Khosla | last post by:
Hi, I am trying to move the file pointer back to the original location, but not able to using seekg, can someone help ? Thanks, Kapil #include "stdafx.h" using std::cerr; using std::endl; using std::ios;
20
3028
by: ishmael4 | last post by:
hello everyone! i have a problem with reading from binary file. i was googling and searching, but i just cant understand, why isnt this code working. i could use any help. here's the source code: --cut here-- typedef struct pkg_ { short int info; char* data;
2
10567
by: Assertor | last post by:
Hi, All. (VC++6.0) I found some strange thins when using getline() and seekg() of std::ifstream. After the file position of an open file was shift to the end of the file, seekg() did not work rightly. (i.e. I could not move the file position to the begin or some position using seekg())
7
1972
by: Michael C | last post by:
I need to read a text file, "rewind" it to the beginning and read it again. I've tried using fstream's seekg(0, ios_base::beg) method with no luck. For some reason it's still thinking it's at eof, even after the seekg is executed. I've also tried closing the fstream and reopening it. Nothing is working. Anyone have any ideas? How do you...
1
6065
by: pantatkau | last post by:
i am trying to use the seekg(offset, base) function to move the read position but cant seem to do it correctly. When i use tellg() to know if the seekg operation is successful or not , the tellg() will always return -1. Heres the code. #include <iostream> using namespace std; int main()
11
3258
by: Markus | last post by:
Hi, I want to get an integer from the user. If the user inserts a character instead of an int the program goes crazy. So I tried something like this: This program works pretty well. But if I put this code in my main program the b-array does not get a value. When I change my code the array does not get a value.
8
2650
by: ashwini1680 | last post by:
I have a problem working with files in c++.This is my code for modifying a record in a file.When i execute it ,it doesn't check rec in file & comes out .What's wrong??? Many time working with file(adding record &then printing on screen or after deletion print the rec )last rec is read twice or otherwise each rec ie read twice I have checked my...
2
2441
by: geseeker | last post by:
Hi, i want to move the file pointer to the last 128th byte, so i can read the ID3V1 tag in an mp3 file. Here's my code to test the result of moving the file pointer: #include <iostream> #include <fstream> using namespace std; int main() { ifstream fin("tagTest.mp3"); char c;
1
3920
by: Sachin Garg | last post by:
I have a program which opens a fstream in binary input+output mode, creating the file if it doesn't exists. But writing doesn't works after reading, it must be something obvious that I am not aware of. f.open(filename,ios::in | ios::out | ios::binary | ios::trunc) The program flow is 1) write some data 2) read the data
0
7628
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
8145
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
7694
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
7993
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
6317
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
5519
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
5245
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
2128
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
0
970
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.