473,289 Members | 2,087 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,289 software developers and data experts.

fread breaks file descriptors opened in "w" mode.

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello all,

For some reasons, somewhere in a program, I'd like, if possible, to quickly
parse a whole file before rewinding it and letting the full analysis start.
My problem is that the FILE* I want do parse has been fopen'ed far away
from where I am and I don't know in which MODE my FILE* has been opened.
And additionally, my FILE* may not be a regular file, but a continuous
stream (pipe), in which case it is not rewindable.

So my program basically behaves like this:

void PreParsing( FILE *my_file )
{
/*
* Test if my FILE * is seekable
*/
if( fseek( my_file, 0, SEEK_SET ) == 0 ) {

/*
* If so, go on for the pre-parsing.
*/
//...
fread( buf, BUF_SIZE, 1, my_file );
//...

/*
* Rewind the file.
*/
if( fseek( my_file, 0, SEEK_SET ) != 0 ) {
// unexpected error since my FILE * was expected to be seekable.
}
}
}

* On both Linux 2.6.xx and Solaris 5.10,

when the my_file is a regular file that has been fopen'ed with "w" as mode,
- the first fseek returns 0 meaning success: my_file is seekable
- the fread returns 0 meaning that there was nothing to read: expected
since a file opened in "w" is truncated, hence is empty, and anyhow, cannot
be read!
- the second fseek returns 0 meaning success: my_file could be rewound.

when the my_file is a pipe that has been fopen'ed with "w" as mode,
- the first fseek returns -1 and errno is set to 29 (Illegal seek).
That's exactly what I expected since a pipe cannot be sought.

Ok. So, on Linux 2.6.xx and Solaris 5.10, my code behaves like I expected
for both regular files and pipes.

* On AIX 5.2,

when the my_file is a pipe that has been fopen'ed with "w" as mode,
- the first fseek returns -1 and errno is set to 29 (Illegal seek).
I'm still OK with that.

but...
when the my_file is a regular file that has been fopen'ed with "w" as mode,
- the first fseek returns 0 meaning success: my_file is seekable
- the fread returns 0 meaning that there was nothing to read: expected
since a file opened in "w" is truncated, hence is empty, and anyhow, cannot
be read!
- the second fseek returns -1 and sets errno to 9 (Bad file number)
I'm a little bit surprised by this error.

In fact, after having had a deeper look on that, it appears to me that a
fread attempt on a FILE * opened in "w" mode breaks it since any subsequent
operation (fseek, fwrite and even fclose !) fails with the error 9 (Bad
file number).
So, on AIX , my function fails to restore the FILE * state at its end.
So, I have a few questions:

- a fread on a FILE * opened in "w" will for sure return 0 item, but is it
really expected that it makes the given FILE * totally unusable even for
fclose !?! This behavior has been observed only on AIX. Linux and Solaris
works.
- given a FILE *, is there a better way to guess in which mode it has been
opened than attempting to read or write it and look at errors ?
- given a FILE *, is there a better way to guess if it can be sought than
attempting a fseek on it ?
PS: I Xposted my problem on both comp.lang.c and comp.unix.aix because I
have no idea whether this is an AIX specific problem or if the C norm
specifies explicitly that fread have unpredictable effects on a write-only
file descriptor. Anyhow, my goal is to find a portable solution that uses
as less platform specific stuff as possible.

Thanks for your advices.
Lénaïc ...still puzzled by AIX behavior...
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (GNU/Linux)

iEYEARECAAYFAkkjPpUACgkQjYEjJATS6Bi55ACgj+RbzOhyjD j63G+ciKo0Iy1B
FuoAn3WsnRc69XXDi2KV0Wt4aOFo0Bpf
=In7u
-----END PGP SIGNATURE-----
Nov 18 '08 #1
15 3147
On Nov 19, 12:15 am, Lénaïc Huard <lenaic.hu...@laposte.netwrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Please don't include that crap in your messages...
Hello all,

For some reasons, somewhere in a program, I'd like, if possible, to quickly
parse a whole file before rewinding it and letting the full analysis start.
My problem is that the FILE* I want do parse has been fopen'ed far away
from where I am and I don't know in which MODE my FILE* has been opened.
Well that's a bad thing, if you want truly meaningful results you
should enforce just one mode, binary or text.
And additionally, my FILE* may not be a regular file, but a continuous
stream (pipe), in which case it is not rewindable.
Load it in memory once, and don't bother with the actual file
rewinding.
So my program basically behaves like this:

void PreParsing( FILE *my_file )
{
/*
* Test if my FILE * is seekable
*/
if( fseek( my_file, 0, SEEK_SET ) == 0 ) {
That isn't testing anything really, except for that very fseek call.
>
/*
* If so, go on for the pre-parsing.
*/
//...
fread( buf, BUF_SIZE, 1, my_file );
I think you probably want fread(buf, 1, BUF_SIZE, my_file);
You should also observe the return value.

<snip observations of implementations>
* On AIX 5.2,
when the my_file is a regular file that has been fopen'ed with "w" as mode,
- the first fseek returns 0 meaning success: my_file is seekable
- the fread returns 0 meaning that there was nothing to read: expected
since a file opened in "w" is truncated, hence is empty, and anyhow, cannot
be read!
- the second fseek returns -1 and sets errno to 9 (Bad file number)
I'm a little bit surprised by this error.
Why? That's allowed by the standard.
In fact, after having had a deeper look on that, it appears to me that a
fread attempt on a FILE * opened in "w" mode breaks it since any subsequent
operation (fseek, fwrite and even fclose !) fails with the error 9 (Bad
file number).
So, on AIX , my function fails to restore the FILE * state at its end.
Well, that's also allowed by the standard (it does however sound like
your implementation has a bug)
So, I have a few questions:

- a fread on a FILE * opened in "w" will for sure return 0 item, but is it
really expected that it makes the given FILE * totally unusable even for
fclose !?! This behavior has been observed only on AIX. Linux and Solaris
works.
The standard allows any function of the standard library to set errno
for any reason. (there are exceptions)
- given a FILE *, is there a better way to guess in which mode it has been
opened than attempting to read or write it and look at errors ?
There's no way to do that in standard C.
- given a FILE *, is there a better way to guess if it can be sought than
attempting a fseek on it ?
No way in standard C.
PS: I Xposted my problem on both comp.lang.c and comp.unix.aix because I
have no idea whether this is an AIX specific problem or if the C norm
specifies explicitly that fread have unpredictable effects on a write-only
file descriptor. Anyhow, my goal is to find a portable solution that uses
as less platform specific stuff as possible.
Well, the standard is okay with this behavior. The implementation
probably has a bug. It's topical in both groups I believe.

Nov 18 '08 #2
Lénaïc Huard wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello all,

For some reasons, somewhere in a program, I'd like, if possible, to quickly
parse a whole file before rewinding it and letting the full analysis start.
My problem is that the FILE* I want do parse has been fopen'ed far away
from where I am and I don't know in which MODE my FILE* has been opened.
You have a design flaw.
And additionally, my FILE* may not be a regular file, but a continuous
stream (pipe), in which case it is not rewindable.
You have a second design flaw....

<snip>
>
So, I have a few questions:

- a fread on a FILE * opened in "w" will for sure return 0 item, but is it
really expected that it makes the given FILE * totally unusable even for
fclose
AFAIK reading from a write-only stream is undefined behaviour. Once you
do something undefined, who knows what will happen.

If you rip pages out of a library book, can you safely return it to the
library?

- given a FILE *, is there a better way to guess in which mode it has been
opened than attempting to read or write it and look at errors ?
Unfortunately the answer is "fix the design flaws in the programme"....
PS: I Xposted my problem on both comp.lang.c and comp.unix.aix
There may be AIX-specific answers to your problem but I can't comment on
that
Nov 18 '08 #3
In article <49**********************@news.free.fr>,
Lénaïc Huard <le**********@laposte.netwrote:
>For some reasons, somewhere in a program, I'd like, if possible, to quickly
parse a whole file before rewinding it and letting the full analysis start.
My problem is that the FILE* I want do parse has been fopen'ed far away
from where I am and I don't know in which MODE my FILE* has been opened.
And additionally, my FILE* may not be a regular file, but a continuous
stream (pipe), in which case it is not rewindable.
I'm at a loss as to why you want to handle the case where the file
has been opened for writing. If you want to read from a file, open
it for reading.

The other aspect - seekability - is entirely reasonable, but I don't
think you can handle it in standard C. If you are (as you appear to
be) using Posix systems, you can stat the underlying file descriptor
and seek only if it is a regular file.

I seem to recall using at least one system where fseek() succeeded
even on pipes provided the seek was within the existing stdio buffer,
so just because one fseek() succeeds, it doesn't mean others will.

-- Richard
--
Please remember to mention me / in tapes you leave behind.
Nov 18 '08 #4
On Nov 19, 12:43 am, Mark McIntyre <markmcint...@TROUSERSspamcop.net>
wrote:
<snip>
AFAIK reading from a write-only stream is undefined behaviour.
I've recently asked this (or remember asking it), but I believe I
received no answers.
I've also searched the standard for the answer, with no luck. Anyone?
Nov 18 '08 #5
vi******@gmail.com a écrit :
>My problem is that the FILE* I want do parse has been
fopen'ed far away from where I am and I don't know in which MODE my FILE*
has been opened.

Well that's a bad thing, if you want truly meaningful results you
should enforce just one mode, binary or text.
Sorry, I wasn't clear enough. My problem is not between binary or text. I
deal only with binary files. The problem is between read or write.

I want to write a kind of « decorator » around a FILE *. And the constructor
of that decorator should parse the file is possible (i.e. if it is a
regular file opened for reading). But unfortunately, I don't know whether
those conditions are met when the constructor is invoked.
>And additionally, my FILE* may not be a regular file, but a continuous
stream (pipe), in which case it is not rewindable.

Load it in memory once, and don't bother with the actual file
rewinding.
But sometimes, this piece of code is used in programs working on continuous
streams. The data must me processed as they come. We can't wait for the
last item before starting to process the first one. And when used in this
context, the total amount of data that will have been read at the end of
the program is too big to fit into memory.
I would like to be able to detect such contexts and to skip the initial
parsing in those cases.
And of course, as I believe in Santa Claus, I try to do this without
modifying the prototypes of a lot of functions to add a read vs. write
information.
>So my program basically behaves like this:

void PreParsing( FILE *my_file )
{
/*
* Test if my FILE * is seekable
*/
if( fseek( my_file, 0, SEEK_SET ) == 0 ) {

That isn't testing anything really, except for that very fseek call.
Indeed, but this was already a workaround. My initial wish was to know
whether I have a chance that the second fseek works or if there is no
chance. In my case, this is nearly equivalent to know whether FILE * is a
regular file or a pipe.
But... I realize that may be such question ought to be put in
comp.unix.programmer instead...
>>
/*
* If so, go on for the pre-parsing.
*/
//...
fread( buf, BUF_SIZE, 1, my_file );

I think you probably want fread(buf, 1, BUF_SIZE, my_file);
You should also observe the return value.
Indeed. Sorry, the real program is better and checks the return. Promise!
>* On AIX 5.2,
when the my_file is a regular file that has been fopen'ed with "w" as
mode,
- the first fseek returns 0 meaning success: my_file is seekable
- the fread returns 0 meaning that there was nothing to read: expected
since a file opened in "w" is truncated, hence is empty, and anyhow,
cannot be read!
- the second fseek returns -1 and sets errno to 9 (Bad file number)
I'm a little bit surprised by this error.

Why? That's allowed by the standard.
I have no problem with the fact that fseek returns an error. But the kind of
error make me feel that the fread didn't simply return 0 item, it also
closed the file descriptor. Further in the program, fclose also issues an
EBADF (Bad file number) error.

My concern is not « fseek shouldn't fail ». It's more : « Should fread
executed on an un-readable stream just return an error or is its behavior
completely undefined (including closing the file descriptor, corrupting
memory, crashing or potentially anything else.) »
>In fact, after having had a deeper look on that, it appears to me that a
fread attempt on a FILE * opened in "w" mode breaks it since any
subsequent operation (fseek, fwrite and even fclose !) fails with the
error 9 (Bad file number).
So, on AIX , my function fails to restore the FILE * state at its end.

Well, that's also allowed by the standard (it does however sound like
your implementation has a bug)

The standard allows any function of the standard library to set errno
for any reason. (there are exceptions)
I understand your point: the standard library functions can, according to
the standard, legally fail at any call and return an appropriate error.
But I would expect that any illegal operation (like reading an un-readable
stream) would return an error, set the errno, and leave the stream
un-modified. And instead of this, I have the feeling that my file
descriptor is closed.
Nov 19 '08 #6
Richard Tobin a écrit :
The other aspect - seekability - is entirely reasonable, but I don't
think you can handle it in standard C. If you are (as you appear to
be) using Posix systems, you can stat the underlying file descriptor
and seek only if it is a regular file.
Sounds to be exactly what I was looking for... I'm still wondering why I
didn't think about stat before.
Thanks!
I seem to recall using at least one system where fseek() succeeded
even on pipes provided the seek was within the existing stdio buffer,
so just because one fseek() succeeds, it doesn't mean others will.
Sounds to be an excellent reason for not testing the seekability with fseek!
Nov 19 '08 #7
Lénaïc Huard wrote:
vi******@gmail.com a �crit :
My problem is that the FILE* I want do parse has been
fopen'ed far away from where I am and I don't know in which MODE my FILE*
has been opened.
Well that's a bad thing, if you want truly meaningful results you
should enforce just one mode, binary or text.

Sorry, I wasn't clear enough. My problem is not between binary or text. I
deal only with binary files. The problem is between read or write.
If you don't know whether a given file has been opened for reading or
writing, you need to re-design your code so that you do know.
I want to write a kind of � decorator � around a FILE *. And the constructor
of that decorator should parse the file is possible (i.e. if it is a
regular file opened for reading). But unfortunately, I don't know whether
those conditions are met when the constructor is invoked.
C doesn't have constructors. Are you actually working in C++? in that
case your question should be re-directed to comp.lang.c++.

....
And of course, as I believe in Santa Claus, I try to do this without
modifying the prototypes of a lot of functions to add a read vs. write
information.
Well, I don't see what Santa has to do with that, but if there's some
legitimate reason why the most obvious fix is s unacceptable, you'll
need to find some other way of passing the information around. One
option is to create a structure with at least two members: a FILE *
and something that keeps track of what mode the file was opened in.
Nov 19 '08 #8
On Nov 18, 2:15*pm, Lénaïc Huard <lenaic.hu...@laposte.netwrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello all,

For some reasons, somewhere in a program, I'd like, if possible, to quickly
parse a whole file before rewinding it and letting the full analysis start.
My problem is that the FILE* I want do parse has been fopen'ed far away
from where I am and I don't know in which MODE my FILE* has been opened.
And additionally, my FILE* may not be a regular file, but a continuous
stream (pipe), in which case it is not rewindable.

So my program basically behaves like this:

void PreParsing( FILE *my_file )
{
* /*
* ** Test if my FILE * is seekable
* **/
* if( fseek( my_file, 0, SEEK_SET ) == 0 ) {

* * /*
* * ** If so, go on for the pre-parsing.
* * **/
* * //...
* * fread( buf, BUF_SIZE, 1, my_file );
* * //...

* * /*
* * ** Rewind the file.
* * **/
* * if( fseek( my_file, 0, SEEK_SET ) != 0 ) {
* * * // unexpected error since my FILE * was expected to be seekable.
* * }
* }

}

* On both Linux 2.6.xx and Solaris 5.10,

when the my_file is a regular file that has been fopen'ed with "w" as mode,
*- the first fseek returns 0 meaning success: my_file is seekable
*- the fread returns 0 meaning that there was nothing to read: expected
since a file opened in "w" is truncated, hence is empty, and anyhow, cannot
be read!
*- the second fseek returns 0 meaning success: my_file could be rewound..

when the my_file is a pipe that has been fopen'ed with "w" as mode,
*- the first fseek returns -1 and errno is set to 29 (Illegal seek).
That's exactly what I expected since a pipe cannot be sought.

Ok. So, on Linux 2.6.xx and Solaris 5.10, my code behaves like I expected
for both regular files and pipes.

* On AIX 5.2,

when the my_file is a pipe that has been fopen'ed with "w" as mode,
*- the first fseek returns -1 and errno is set to 29 (Illegal seek).
I'm still OK with that.

but...
when the my_file is a regular file that has been fopen'ed with "w" as mode,
*- the first fseek returns 0 meaning success: my_file is seekable
*- the fread returns 0 meaning that there was nothing to read: expected
since a file opened in "w" is truncated, hence is empty, and anyhow, cannot
be read!
*- the second fseek returns -1 and sets errno to 9 (Bad file number)
I'm a little bit surprised by this error.

In fact, after having had a deeper look on that, it appears to me that a
fread attempt on a FILE * opened in "w" mode breaks it since any subsequent
operation (fseek, fwrite and even fclose !) fails with the error 9 (Bad
file number).
So, on AIX , my function fails to restore the FILE * state at its end.

So, I have a few questions:

*- a fread on a FILE * opened in "w" will for sure return 0 item, but is it
really expected that it makes the given FILE * totally unusable even for
fclose !?! This behavior has been observed only on AIX. Linux and Solaris
works.
*- given a FILE *, is there a better way to guess in which mode it has been
opened than attempting to read or write it and look at errors ?
*- given a FILE *, is there a better way to guess if it can be sought than
attempting a fseek on it ?

PS: I Xposted my problem on both comp.lang.c and comp.unix.aix because I
have no idea whether this is an AIX specific problem or if the C norm
specifies explicitly that fread have unpredictable effects on a write-only
file descriptor. Anyhow, my goal is to find a portable solution that uses
as less platform specific stuff as possible.

Thanks for your advices.
Lénaïc ...still puzzled by AIX behavior...
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (GNU/Linux)

iEYEARECAAYFAkkjPpUACgkQjYEjJATS6Bi55ACgj+RbzOhyjD j63G+ciKo0Iy1B
FuoAn3WsnRc69XXDi2KV0Wt4aOFo0Bpf
=In7u
-----END PGP SIGNATURE-----
Partial solution - you can discover if it is a PIPE or a Special
Device
by doing a "stat" on it and checking the
mode:

Passed in as a parm: FILE *fp;

struct stat my_stat;
mode_t the_type;

fstat ( fileno(fp), &my_stat);

/* apply mask to get just file_type */
the_type = (my_stat.st_mode & _S_IFMT )

if ( the_type == _S_IFIFO ) {
printf("Its a pipe\n");
}else{
if ( the_type == _S_IFBLK ) {
printf("It is a Block Special device\n");
}else{
if ( the_type == _S_IFCHR ) {
printf("It is a Character Special device\n");
....... etc....

-tony
Nov 19 '08 #9
On Tue, 18 Nov 2008 17:14:21 -0800 (PST),
be**********@con-way.com <be**********@con-way.comwrote:
On Nov 18, 2:15Â*pm, Lénaïc Huard <lenaic.hu...@laposte.netwrote:
>For some reasons, somewhere in a program, I'd like, if possible, to quickly
parse a whole file before rewinding it and letting the full analysis start.
My problem is that the FILE* I want do parse has been fopen'ed far away
from where I am and I don't know in which MODE my FILE* has been opened.
And additionally, my FILE* may not be a regular file, but a continuous
stream (pipe), in which case it is not rewindable.
Partial solution - you can discover if it is a PIPE or a Special
Device
by doing a "stat" on it and checking the
mode:
[snip code using fstat() and its associated macros]

Of course, this is not standard C, but POSIX. If you are indeed using a
POSIX or POSIX-like system, and you want to use that API, you
should probably be discussing this in comp.unix.programmer, as the
people there tend to know a lot more about POSIX, on average, than the
people here.

Martien
--
|
Martien Verbruggen | This matter is best disposed of from a great
| height, over water.
|
Nov 19 '08 #10
Lénaïc Huard wrote:
Richard Tobin a écrit :
>The other aspect - seekability - is entirely reasonable, but I
don't think you can handle it in standard C. If you are (as you
appear to be) using Posix systems, you can stat the underlying
file descriptor and seek only if it is a regular file.

Sounds to be exactly what I was looking for. I'm still
wondering why I didn't think about stat before. Thanks!
>I seem to recall using at least one system where fseek()
succeeded even on pipes provided the seek was within the
existing stdio buffer, so just because one fseek() succeeds,
it doesn't mean others will.

Sounds to be an excellent reason for not testing the seekability
with fseek!
And it is entirely off-topic on c.l.c, so all such answers are
necessarily suspect. If you ask on comp.unix.programmer, however,
you will probably be on-target and get valid answers and criticisms
of those answers.

As an aside, if a file is opened in "w" mode, you can't do many
things to it. Read the C standard.

--
[mail]: Chuck F (cbfalconer at maineline dot net)
[page]: <http://cbfalconer.home.att.net>
Try the download section.
Nov 19 '08 #11
vi******@gmail.com wrote:
On Nov 19, 12:43 am, Mark McIntyre <markmcint...@TROUSERSspamcop.net>
wrote:
<snip>
AFAIK reading from a write-only stream is undefined behaviour.

I've recently asked this (or remember asking it), but I believe I
received no answers.
I've also searched the standard for the answer, with no luck. Anyone?
It's undefined behavior by virture of the fact that all I/O takes place
as if by calls to fgetc() and fputc(), and their behavior is only
defined for input and output streams, respectively.
--
Larry Jones

Talk about someone easy to exploit! -- Calvin
Nov 19 '08 #12
On Nov 19, 8:50 pm, lawrence.jo...@siemens.com wrote:
vipps...@gmail.com wrote:
On Nov 19, 12:43 am, Mark McIntyre <markmcint...@TROUSERSspamcop.net>
wrote:
<snip>
AFAIK reading from a write-only stream is undefined behaviour.
I've recently asked this (or remember asking it), but I believe I
received no answers.
I've also searched the standard for the answer, with no luck. Anyone?

It's undefined behavior by virture of the fact that all I/O takes place
as if by calls to fgetc() and fputc(), and their behavior is only
defined for input and output streams, respectively.
Ah, I suspected something like that. Thanks!
Nov 20 '08 #13
Lénaïc Huard wrote:
So, I have a few questions:

- a fread on a FILE * opened in "w" will for sure return 0 item, but is it
really expected that it makes the given FILE * totally unusable even for
fclose !?! This behavior has been observed only on AIX. Linux and Solaris
works.
- given a FILE *, is there a better way to guess in which mode it has been
opened than attempting to read or write it and look at errors ?
Once you've eliminated the pipe possibility, dup() the descriptor and
fdopen() the duplicate in r-w mode. Close the old one.

You shouldn't be attempting to read from a stream opened for writing.
That makes no sense and getting undefined, inconsistent results seems
reasonable.

Nov 20 '08 #14
"Gary R. Hook" <gh***@no.spammers.netwrites:
Lénaïc Huard wrote:
>So, I have a few questions:
- a fread on a FILE * opened in "w" will for sure return 0 item,
but is it
really expected that it makes the given FILE * totally unusable even for
fclose !?! This behavior has been observed only on AIX. Linux and Solaris
works.
- given a FILE *, is there a better way to guess in which mode it has been
opened than attempting to read or write it and look at errors ?
There's no portable way to do it.
Once you've eliminated the pipe possibility, dup() the descriptor and
fdopen() the duplicate in r-w mode. Close the old one.
dup() and fdopen() are defined by POSIX. Using them is ok as long as
you don't mind limiting your code's portability to POSIX
implementations.
You shouldn't be attempting to read from a stream opened for
writing. That makes no sense and getting undefined, inconsistent
results seems reasonable.
Right, reading from a file opened in "w" mode invokes undefined
behavior.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Nov 20 '08 #15
In article <%V*****************@flpi149.ffdc.sbc.com>,
Gary R. Hook <gh***@no.spammers.netwrote:
>Once you've eliminated the pipe possibility, dup() the descriptor and
fdopen() the duplicate in r-w mode. Close the old one.
What is this supposed to do? If the underlying file descriptor is
opened for writing only, fdopen()ing it read-write won't do you
any good.

-- Richard
--
Please remember to mention me / in tapes you leave behind.
Nov 20 '08 #16

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

Similar topics

0
by: Masiar Farahani | last post by:
Hi, Is there a option in PythonWin to write files in unix file mode? Regards Masiar
7
by: Scott Chapman | last post by:
Hi! I'd like a "file" on the Linux box to actually be the input and output of a Python script. Anything written to the file would be sent to a database and anything read from the file would...
6
by: Uwe Mayer | last post by:
Hi, when extending a build in class, what does the constructor __init__(...) have to return? and how does the constructor call its base-class construtor? (or is this done automatically?) I...
11
by: David Morgenthaler | last post by:
How does one overide the iterator implied by the construct "for line in file:"? For example, suppose I have a file containing row,col pairs on each line, and I wish to write a subclass of file...
1
by: Matt | last post by:
When we click Browse button, <input type="FILE">, can we set the default of the directory to open?? For example, C:\MYFILES are open when the file open dialog is opened. please advise. thanks!!
1
by: jingkun Hu via .NET 247 | last post by:
(Type your message here) I'm upgrading a VC++ 6 project to VC.NET 2003. The compiling isOK but not linking. The error message is "mfc42.lib cannot beopened". I looked through every setting of...
4
by: Joe Lester | last post by:
I'm trying to figure out what the optimal Postgres configuration would be for my server (with 200 connecting clients, even though I'd really like to get it up to 500). I've got a 700 MHz eMac...
1
by: weird0 | last post by:
System.Data.SqlClient.SqlException: An attempt to attach an auto- named database for file "Location" failed. A database with the same name exists, or specified file cannot be opened, or it is...
9
by: hstagni | last post by:
I tried to use fseek in a file opened for writing: ------ BEGIN ------- int main() { char c; FILE *fp; fp=fopen("texto", "wb"); putc('a', fp); putc('b', fp);
2
by: jjlagtap | last post by:
Hey everyone When I try to open a file i get the Exception listed below. The weird thing is it works when I run the web app locally and when i use a remote server and open a file on my computer....
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...

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.