荔园在线

荔园之美,在春之萌芽,在夏之绽放,在秋之收获,在冬之沉淀

[回到开始] [上一篇][下一篇]


发信人: tang (独孤九剑), 信区: Program
标  题: MSVC-BEGINNERS Digest - 15 May 1998 to 16 May
发信站: BBS 荔园晨风站 (Mon May 18 12:50:12 1998), 转信

There are 4 messages totalling 153 lines in this issue.

Topics of the day:

  1. CArchieve Exceptions
  2. UserId in VC++ ?
  3. quick question...
  4. Please Help! COM Example
Hi,

Env: win 95, VC 5.0

I am using CArchive object to read the document. Everything is fine, but at the
end of the reading I am getting two types of exceptions.  one is  End of file
exc
eptions. This I am handling without any problem. and the other one is 0x000005
ex
ception. I didn't understand where it is coming from. I tried to catch this
excep
tion but proved vain. Can any body suggest why this? the sample code is as below


BOOL CMyDocument::ReadFileContents(CString &sFileName, .....)
{
        CFile cfile;
        BOOL rValue = FALSE;
        char buf[512];
        if( !cfile.Open(sFileName,  CFile::modeRead ) )
                return rValue ;

        CArchive ar( &cfile, CArchive::load, 512, buf );

        BOOL bworking = TRUE;
        while(bworking)
        {
                CString str;
                try
                {
                        bworking = ar.ReadString(str) ;
                }
                catch( CException* e )
                {
                        // Handle the exception here.
                        // "e" contains information about the exception.
                        e->Delete();
                }
                catch(...)
                {
                        // Handle the all the other type of exceptions if at all
 exists.
                        // BTW, how to get the execption object when using this
type of ellipse arguments.
                        TRACE0("Got other exception");
                }
                if(!bworking)
                        break;
                .........
                .........
                .........
                .........
        }
        ar.Close();
        cfile.Close();

        return rValue;
}

Thanx in advance.
From: Natesan, Ramki <RNatesan@BACTC.COM>
   How can I get UserID in VC++ ?

As far as i know, the user id is the login name of the user.  getting which
is very straight forward.

Try this. (this will work in c, c++, vc++. win95,NT).

char *uid;
uid = getenv( "LOGNAME" );
if( uid != NULL )
TRACE( "User ID is: %s\n",uid );

Hope this helps.

Regards,

Raghu
Software Engineer,
Ruksun Software Technologies,
svraghu@ruksun.com

~~~~~~~~~~~~~~~~~~~
Dreams and Dedication make a powerful Combination.
~~~~~~~~~~~~~~~~~~~
MSVC 5. Win95.

Ok, summer is here and I'm finally taking the time to use MSVC as it should
be used. The question I have to ask is something I can do by creating my
own files and the like and continuing from there, but this time I choose to
use the MFC wizard. I've created a MDI and now wish to add some code to it.
I have a file that has its contents in this format:

Day, mm/dd/yy      00      00      00      00      00      00
            $000,000,000

(the spacing is not exact)

now what I would like to do (well, step one) is to open the file, read in
the data, store it into a node, and then display the contents. I choose the
linked list option because the size of this list will vary. Could someone
guide me in the right direction as to how I might accomplish this through
use of the class wizard or whatever else would be appropriate?

*side note- I don't wish to make the date a string, because I wish to
perform calculations with it.

Trying to learn-
Franklyn
Hi Everyone,

Could anyone direct me to where I could find some good examples on COM?  I
am interested in examples using VC++/MFC and C++.

TIA
Ronald
dlcom@earthlink.net
--
        There are these few times I feel lonely for you.
        But I know this shade of blue will soon pass through!
        I must be strong without you by my side!
        I can see forever you are my light.

※ 来源:.BBS 荔园晨风站 bbs.szu.edu.cn.[FROM: 192.168.0.4]


[回到开始] [上一篇][下一篇]

荔园在线首页 友情链接:深圳大学 深大招生 荔园晨风BBS S-Term软件 网络书店