Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 3

Qt-interest Archive, May 2008
Looking for a general read file function


Message 1 in thread

Hi,

I meet a NO-Qt environment, where I have to use STL open and read/get 
character by character from a file.
What I did:
  _wfopen_s(&fp, fileName.c_str(), L"rb");
and
bool Source::get(wchar_t &ch)
{
  if (!fp) return false;
  if ((ch = getwc(fp)) == WEOF) return false;
  return true;
}
It reads text files very well, but it cannot read through a binary file.
I guess it is stopped because WEOF is meet in the middle of a binary file.

Could you please help me out?

Thanks,
Lingfa

--
 [ signature omitted ] 

Message 2 in thread

Hi,

> I meet a NO-Qt environment, where I have to use STL open and read/get 
> character by character from a file.

This really doesn't look like it's related to Qt, is it?

-- 
 [ signature omitted ] 

Message 3 in thread

Dimitri wrote:
> Hi,
>
>> I meet a NO-Qt environment, where I have to use STL open and read/get 
>> character by character from a file.
>
> This really doesn't look like it's related to Qt, is it?
>
TRUE! But a Qt-guy does not alway, or not only, works with Qt, right? So 
if someone can help, please help.

Thanks,
Lingfa

--
 [ signature omitted ] 

Message 4 in thread

But there are generic C++ lists for that

> -----Original Message-----
> From: Lingfa Yang [mailto:lingfa@xxxxxxxxxxxx]
> Sent: Thursday, May 15, 2008 1:36 PM
> To: qt-interest@xxxxxxxxxxxxx
> Cc: Qt Interest
> Subject: Re: Looking for a general read file function
> 
> Dimitri wrote:
> > Hi,
> >
> >> I meet a NO-Qt environment, where I have to use STL open and
> read/get
> >> character by character from a file.
> >
> > This really doesn't look like it's related to Qt, is it?
> >
> TRUE! But a Qt-guy does not alway, or not only, works with Qt, right?
> So
> if someone can help, please help.
> 
> Thanks,
> Lingfa
> 
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with
> "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/

--
 [ signature omitted ] 

Message 5 in thread

Scott Aron Bloom wrote:
> But there are generic C++ lists for that
>
>   
Yes, sir. This is the first time I realize here is Qt-only. Please help 
remove my question.
Thanks and Bye,
Lingfa


--
 [ signature omitted ] 

Message 6 in thread


"Lingfa Yang" <lingfa@xxxxxxxxxxxx> wrote in message 
news:482C8B38.2060305@xxxxxxxxxxxxxxx
> Hi,
>
> I meet a NO-Qt environment, where I have to use STL open and read/get 
> character by character from a file.
Easy answer, applicable to this list, is of course to migrate your project 
to use Qt, and use all of it´s goodness to solve your file reading problems 
:-) QFile and QByteArray come to mind...
If migrating to use Qt in your project is not an option, then the comments 
of the other posters in this tread come to mind, and this question belongs 
on another forum/list/group/channel/...

André
 

--
 [ signature omitted ] 

Message 7 in thread

Am Freitag, 16. Mai 2008 schrieb André Somers:
> "Lingfa Yang" <lingfa@xxxxxxxxxxxx> wrote in message
> > I meet a NO-Qt environment, where I have to use STL open and read/get
> > character by character from a file.
> Easy answer, applicable to this list, is of course to migrate your project
> to use Qt, and use all of it´s goodness to solve your file reading problems
> :-) QFile and QByteArray come to mind...
> If migrating to use Qt in your project is not an option, then the comments
> of the other posters in this tread come to mind, and this question belongs
> on another forum/list/group/channel/...

Another option is to rip the needed files out of qt and ship them with your 
application.
Which only works if your application is in-house only or gets published under 
the gpl...

If you want to stay C-only: Reading and writing files with C is bad...
Doing so in plain-C++ with streams is a lot easier, but not quite as good as 
with qt. Anytime I try to stay within plain-C++, I switch to using Qt as soon 
as file-access is involved. ;-)

Arnold
-- 
 [ signature omitted ] 

Attachment: signature.asc
Description: This is a digitally signed message part.