首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C语言 >

50分

2012-03-15 
50分求助!C/C++ code// Project3.cpp : Defines the entry point for the console application.//#include

50分求助!

C/C++ code
// Project3.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include <string.h>#include <stdlib.h>#include <malloc.h>#include <assert.h>#include <conio.h>//read the file into bufferchar *readFile(const char *fileName){       assert(fileName !=NULL);    FILE *pFILE = fopen(fileName, "rb");    char ch = fgetc(pFILE);    assert(!feof(pFILE));    fseek(pFILE, 0, SEEK_END);    long fileSize = ftell(pFILE);    rewind(pFILE);  //fseek(pFILEBuff, 0, SEEK_SET);    char *pFILEBuff = (char*)malloc(sizeof(char)*fileSize);    assert(pFILEBuff != NULL);    size_t result = fread(pFILEBuff, 1, fileSize, pFILE);    assert(result == fileSize);    return pFILEBuff;}struct wordInfo{     char *pstr;};struct wordInfo *pWordInfo = (struct wordInfo*)realloc(pWordInfo, 100);//maybe wrong!!!void split(const char *fileName){       char *pFILEBuff = readFile(fileName);    char *ptoken;    ptoken = strtok(pFILEBuff," ");    while(ptoken)    {         ptoken = strtok(NULL," ");       char *pstring = NULL;       realloc(pstring, sizeof(ptoken));       strcpy(pstring, ptoken);       pWordInfo->pstr = pstring;    }}//must use qsortvoid wordsort(){    qsort (void * base, size_t nmem, size_t size , comp) ; //call this    //output results}int comp(const void *p, const void *q) {     return (*( int*)p - *(int*)q) ; }int _tmain(int argc, _TCHAR* argv[]){       /*    char *fileName;    split(fileName);    wordsort();    */    system("pause");    return 0;}


[解决办法]
...什么问题?
[解决办法]
想做啥
[解决办法]
相当悲剧,没有main函数
[解决办法]
探讨
相当悲剧,没有main函数

热点排行