Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

C/C++ Îļþ¶Áд²Ù×÷×ܽá

 C/C++ Îļþ¶Áд²Ù×÷×ܽá
ÔÚ±à³ÌµÄ¹ý³ÌÖУ¬ÎļþµÄ²Ù×÷ÊÇÒ»¸ö¾­³£Óõ½µÄÎÊÌ⣬ÔÚC++BuilderÖУ¬¿ÉÒÔʹÓöàÖÖ·½·¨¶ÔÎļþ²Ù×÷£¬ÏÂÃæÎҾͰ´ÒÔϼ¸¸ö²¿·Ö¶Ô´Ë×÷Ïêϸ½éÉÜ£¬¾ÍÊÇ£º
 
1¡¢»ùÓÚCµÄÎļþ²Ù×÷£»
2¡¢»ùÓÚC++µÄÎļþ²Ù×÷£»
3¡¢»ùÓÚWINAPIµÄÎļþ²Ù×÷£»
4¡¢»ùÓÚBCB¿âµÄÎļþ²Ù×÷£»
5¡¢ÌØÊâÎļþµÄ²Ù×÷¡£
Ò¼¡¢»ùÓÚCµÄÎļþ²Ù×÷
¡¡¡¡ÔÚANSI CÖУ¬¶ÔÎļþµÄ²Ù×÷·ÖΪÁ½ÖÖ·½Ê½£¬¼´Á÷ʽÎļþ²Ù×÷ºÍI/OÎļþ²Ù×÷£¬ÏÂÃæ¾Í·Ö±ð½éÉÜÖ®¡£
Ò»¡¢Á÷ʽÎļþ²Ù×÷
¡¡¡¡ÕâÖÖ·½Ê½µÄÎļþ²Ù×÷ÓÐÒ»¸öÖØÒªµÄ½á¹¹FILE£¬FILEÔÚstdio.hÖж¨ÒåÈçÏ£º
typedef struct {
int level; /* fill/empty level of buffer */
unsigned flags; /* File status flags */
char fd; /* File descriptor */
unsigned char hold; /* Ungetc char if no buffer */
int bsize; /* Buffer size */
unsigned char _FAR *buffer; /* Data transfer buffer */
unsigned char _FAR *curp; /* Current active pointer */
unsigned istemp; /* Temporary file indicator */
short token; /* Used for validity checking */
} FILE; /* This is the FILE object */
¡¡¡¡FILEÕâ¸ö½á¹¹°üº¬ÁËÎļþ²Ù×÷µÄ»ù±¾ÊôÐÔ£¬¶ÔÎļþµÄ²Ù×÷¶¼ÒªÍ¨¹ýÕâ¸ö½á¹¹µÄÖ¸ÕëÀ´½øÐУ¬´ËÖÖÎļþ²Ù×÷³£Óõĺ¯Êý¼ûÏÂ±í º¯Êý ¹¦ÄÜ
fopen() ´ò¿ªÁ÷
fclose() ¹Ø±ÕÁ÷
fputc() дһ¸ö×Ö·ûµ½Á÷ÖÐ
fgetc() ´ÓÁ÷ÖжÁÒ»¸ö×Ö·û
fseek() ÔÚÁ÷Öж¨Î»µ½Ö¸¶¨µÄ×Ö·û
fputs() д×Ö·û´®µ½Á÷
fgets() ´ÓÁ÷ÖжÁÒ»ÐлòÖ¸¶¨¸ö×Ö·û
fprintf() °´¸ñʽÊä³öµ½Á÷
fscanf() ´ÓÁ÷Öа´¸ñʽ¶ÁÈ¡
feof() µ½´ïÎļþβʱ·µ»ØÕæÖµ
ferror() ·¢Éú´íÎóʱ·µ»ØÆäÖµ
rewind() ¸´Î»Îļþ¶¨Î»Æ÷µ½Îļþ¿ªÊ¼´¦
remove() ɾ³ýÎļþ
fread() ´ÓÁ÷ÖжÁÖ¸¶¨¸öÊýµÄ×Ö·û
fwrite() ÏòÁ÷ÖÐдָ¶¨¸öÊýµÄ×Ö·û
tmpfile() Éú³ÉÒ»¸öÁÙʱÎļþÁ÷
tmpnam() Éú³ÉÒ»¸öΨһµÄÎļþÃû
¡¡¡¡ÏÂÃæ¾Í½éÉÜÒ»ÏÂÕâЩº¯Êý
1.fopen()
¡¡¡¡fopenµÄÔ­ÐÍÊÇ£ºFILE *fopen(const char *filename,const char *mode)£¬fopenʵÏÖÈý¸ö¹¦ÄÜ
ΪʹÓöø´ò¿ªÒ»¸öÁ÷
°ÑÒ»¸öÎļþºÍ´ËÁ÷ÏàÁ¬½Ó
¸ø´ËÁ÷·µ»ØÒ»¸öFILRÖ¸Õë
²ÎÊýfilenameÖ¸ÏòÒª´ò¿ªµÄÎļþÃû£¬mode±íʾ´ò¿ª×´Ì¬µÄ×Ö·û´®£¬ÆäÈ¡ÖµÈçϱí
×Ö·û´® º¬Òå
"r" ÒÔÖ»¶Á·½Ê½´ò¿ªÎļþ
"w" ÒÔֻд·½Ê½´ò¿ªÎļþ
"a" ÒÔ×·¼Ó·½Ê½´ò¿ªÎļþ
"r+" ÒÔ¶Á/д·½Ê½´ò¿ªÎļþ£¬ÈçÎÞÎļþ³ö´í
"w+" ÒÔ¶Á/д·½Ê½´ò¿ªÎļþ£¬


Ïà¹ØÎĵµ£º

C_ʹÓöþάÊý×é×÷³ö¾ØÕóͼ

 Ô´Â룺
# include <stdio.h>
 
int main()
{
    int array[16][16];
    int i, j, k, m, n;
     
    /* ±äÁ¿³õʼ»¯ */
    m = 1;
    while(m == 1)
    {
   ......

C Sharp(C#)ÖÐÈçºÎɾ³ýÎļþ(Îļþ¼Ð)

C Sharp(C#)ÖÐÈçºÎɾ³ýÎļþ(Îļþ¼Ð)
Ö±½Óɾ³ý:
using System.IO;
...
string filePath = @"D:\...\xxx.xxx";

if (File.Exists(filePath))
{
File.Delete(filePath);
}
else
{
Console. ......

¡¶C³ÌÐòÉè¼ÆÓïÑÔ¡·¶ÁÊé±Ê¼Ç20091106

     ÊéÖÐÓм¸¸öÎÊÌâÓеãÄ£ºý¡£¼Ç¼һÏ¡£
    
Answer to Exercise 1-7
Write a program to print the value of EOF .
 
#include <stdio.h>
 
int main(void)
{
  printf("The value of EOF is %d\n\n", EOF);
 
  return 0 ......

virtualBox ´ó°á¼Ò ´ÓCÅÌÒÆ×ß

 ¼´Ê¹½«VirtualBox°²×°µ½±ðµÄÅÌÉÏ£¬Æä×ö³ÉµÄÐéÄâ»ú£¨ÏµÍ³£¬Ó²ÅÌ£©ÈÔ»áĬÈÏÉú³Éµ½ÏµÍ³ÅÌ£¬Ä¬ÈÏC:ÅÌÉÏ£¬Ëæ×ÅÐé»úÊýÁ¿ºÍÄÚÈÝÔö¼Ó¼·Õ¼Á˱¾À´¾Í²»´óµÄϵͳÅ̿ռ䣬ºÜÊDz»±ã¡£
 ¿ªÊ¼½«C:ÅÌÏÂ.VirtualBoxĿ¼ÏµĶ«Î÷È«ÅÌ¿½±´ÖÁ±ð´¦,È»ºóÔÚVirtualBoxµÄÎļþ/»·¾³ÉèÖà Öн«¡ºÄ¬ÈÏÓ²ÅÌĿ¼¡»ºÍ¡ºÄ¬ÈϼÙÏë»úÆ÷¡»×öÏàÓ¦µÄÐÞ ......

C/C++µÄÌõ¼þ±àÒë

ÒÔΪÒѾ­ÕÆÎÕÌõ¼þ±àÒ룬Ԥ±àÒëµÄÒªÁìÁË£¬½á¹û»¹ÊÇ´æÔںܶàÒÅ©µÄµØ·½£¬ËùÒÔ¹æÕûһϣº
Ìõ¼þ±àÒ룺
1
#ifdef _XXXX
...³ÌÐò¶Î1...
#else
...³ÌÐò¶Î2...
#endif
  Õâ±íÃ÷Èç¹û±êʶ·û_XXXXÒѱ»#defineÃüÁÒå¹ýÔò¶Ô³ÌÐò¶Î1½øÐбàÒ룻·ñÔò¶Ô³ÌÐò¶Î2½øÐбàÒë¡£
2
#ifndef _XXXX
...³ÌÐò¶Î1...
#else
...³ÌÐ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ