2007年8月6日

前几天同事遇到一个小问题,他想编个小工具,主要用来在每个.cpp文件的开始加入一句公共的#include "",于是,感觉自己在C++这里好像也是个盲点,所以就帮忙一起想想,同时也有了一个想法就是可以借此系统的对C++和MFC,或者更多的类似问题和关于文件输入和输出的问题做个透彻的认识,同时也是想利用网络,来获得更多的事例和想法,或深刻的见解,请大家不吝赐教。
我先起个头第一期是关于CFile及其派生类
Use CFile and its derived classes for general-purpose disk I/O. Use ofstream or other Microsoft iostream classes for formatted text sent to a disk file.
It directly provides unbuffered, binary disk input/output services, and it indirectly supports text files and memory files through its derived classes.
Note that deleting the CFile object does not delete the physical file in the file system.
If you have not closed the file before destroying the object, the destructor closes it for you.
If you used new to allocate the CFile object on the heap, then you must delete it after closing the file. Close sets m_hFile to CFile::hFileNull.
So the member function Duplicate() should be use with Close() function, because of a new object which is created.
以上是个人在作例子和浏览msdn获得的一些结论,当然,除了单纯的针对本问题的关键是如何解决文件的随机读写,同时就是详细的文件输入和输出操作的结论,希望各位能够把自己遇到的关于文件输入输出操作的问题或解决方案共享出来,使我们每个人都能从中受益,同时享受技术带给我们的那份喜悦

posted @ 2007-08-06 01:09 谢迎飞 阅读(1055) | 评论 (5)编辑 收藏


2007年8月5日

刚看完蜘蛛侠3,还不错,看到结尾两个朋友冰释前嫌,但还是牺牲了一位,可是在朋友的葬礼上一个幕后的独白,挺有感触,生平第一次有意识的去听写英文电影原声,有些惭愧,请各位阅读者别嫌弃哦,现在就献上:
Whatever come with on our way, whatever bad we have rage inside, we  always have choice.
My friend tell me that, and he chose to be the best himself.
It is the choice make us who we are, and we can always choose to do what is right.
不知道加上下面的翻译是否会减去原文的意义呢,总之,还是希望或许某时能得到不同的感觉,影片上的翻译是:
不管我们碰到什么事,不管我们内心有什么怒火,我们总是有选择的。
这是我的朋友哈里教我的。他选择做最好的他。
我们的选择决定了我们是什么样的人,我们永远可以选择去做正确的事。

posted @ 2007-08-05 00:11 谢迎飞 阅读(452) | 评论 (0)编辑 收藏


2007年7月29日

C++, 在今天大家都在专注于.NET和J2EE的时候,我却喜欢上了C++,是喜欢还是因为它更接近底层,我也不知道。自己总觉得是因为在自己喜欢的领域,它或许是最佳的选择。但是,也听过一些牛人说把一门语言学精通了,其他也可以触类旁通。我相信。所以,现在不曾动摇过,在不想以前那样,样样都学点。到最后,毫无功底。同时,也一直对这次经历常抱感恩之心。虽然很多事不尽如人意,但却给了我在技术道路上不断前行的指引。

posted @ 2007-07-29 16:03 谢迎飞 阅读(272) | 评论 (2)编辑 收藏


仅列出标题  

posts - 3, comments - 7, trackbacks - 0, articles - 0

Copyright © 谢迎飞