ʹÓÃmex CÉú³ÉMATLABµÄ¹ÉƱÊý¾Ý·ÖÎö½Ó¿Ú
#include "mex.h"
#define DWORD long
#define NUMBER_OF_STRUCTS (sizeof(friends)/sizeof(struct phonebook))
#define NUMBER_OF_FIELDS (sizeof(field_names)/sizeof(*field_names))
void mexFunction(int nlhs,
mxArray * plhs[] , int nrhs,const mxArray * pahs[])
{
typedef struct {
DWORD dt; //ÈÕÆÚ: ±ÈÈç¶Á³öÊý¾ÝΪ20031110,´ú±í2003Äê11ÔÂ10ºÅ
DWORD k_price;//¿ªÅ̼Û*0.01£¨£©:¶Á³öµÄ¼Û¸ñ³Ë0.01Ϊʵ¼Ê¼Û¸ñ¡£ÏÂͬ¡£
DWORD h_price;//×î¸ß¼Û*0.01
DWORD l_price;//×îµ×¼Û*0.01
DWORD s_price;//ÊÕÅ̼Û
float s_tolmoney;//(µ¥Î»:ÒÚ)
DWORD bur_tol;//³É½»Á¿
DWORD unknown; ///ûÓÐʹÓÃ
}ST_K_DATE;
FILE * f = 0;
int nfieldidx= 0;
char * pkdata;
int lday = 8;
int dims[2] = {1, lday };
char msg[128] = "";
char path[512] = {0};
int i,r,c ,*val;
double *kp,*sp,*hp,*lp,*tm,*vol;
int lseekpos;
mxArray *field_value;
const char *field_names[] = {"ÈÕÆÚ", "¿ªÅ̼Û","×î¸ß¼Û","×îµÍ¼Û","ÊÕÅ̼Û","³É½»½ð¶î","³É½»Á¿"};
ST_K_DATE * pd = 0;
r = mxGetM(pahs[0]);
c = mxGetN(pahs[0]);
sprintf(msg,"r:%d , c:%d rn",r,c);
mexPrintf(msg);
mxGetString(pahs[0],msg,128);
sprintf(path,"D:\jcb_hxzq\vipdoc\sh\lday\sh%s.day",msg);
me
Ïà¹ØÎĵµ£º
×Ö·û´®×ª»»Æª
atof
atoi
atol
gcvt
strtod
strtol
strtoul
toascii
tolower
toupper
atof£¨½«×Ö·û´®×ª»»³É¸¡µãÐÍÊý£©
Ïà¹Øº¯Êý
atoi£¬atol£¬strtod£¬strtol£¬strtoul
±íÍ·Îļþ
#include <stdlib.h>
¶¨Ò庯Êý
double atof(const char *nptr);
º¯Êý˵Ã÷
atof()»áɨÃè²ÎÊýnptr×Ö·û´®£¬Ìø¹ýÇ°Ãæµ ......
1 ÔÚ½â¾ö·½°¸ÖÐÌí¼ÓWindows°²×°ÏîÄ¿
˼·: A ÆäËüÏîÄ¿ÀàÐÍ->°²×°ºÍ²¿Êð
B Ñ¡Ôñ°²×°ÏîĿģ°å
2 Íê³É³ÌÐòµÄÌí¼Ó
˼·: A Ñ¡ÖÐÓ¦ÓóÌÐòÎļþ¼Ð->ÓÒ¼üÑ¡ÔñÌí¼ÓÎļþ->
Ñ¡ÖÐÓ¦ÓóÌÐò(ÏîÄ¿Ãû.exe)£¨Íê³É³ÌÐòµÄ´ò°ü£ ......
C×Ö·û´®´¦Àíº¯ÊýµÄʵÏÖ£¨Linux£©
#include <stddef.h>
char * ___strtok = NULL;
char * strcpy(char * dest,const char *src)
{
char *tmp = dest;
while ((*dest++ = *src++) != '\0')
/* nothing */;
return tmp;
}
char * strncpy(char * des ......
http://www.ibm.com/developerworks/cn/aix/library/au-toughgame/index.html
Ó¢ÎÄÔÎÄ
ÒýÑÔ
¶ÔÓÚÈκÎʹÓà C ÓïÑÔµÄÈË£¬Èç¹ûÎÊËûÃÇ C ÓïÑÔµÄ×î´ó·³ÄÕÊÇʲô£¬ÆäÖÐÐí¶àÈË¿ÉÄÜ»á»Ø´ð˵ÊÇÖ¸ÕëºÍÄÚ´æÐ¹Â©
¡£ÕâЩµÄÈ·ÊÇÏûºÄÁË¿ª·¢ÈËÔ±´ó¶àÊýµ÷ÊÔʱ¼äµÄÊÂÏî¡£Ö¸ÕëºÍÄÚ´æÐ¹Â©¶ÔijЩ¿ª·¢ÈËÔ±À´ËµËƺõÁîÈËη¾å£¬µ«ÊÇÒ»µ©ÄúÁ˽ ......
Ê×ÏÈ˵Ã÷Ò»ÏÂÕâ¸ö”¿ì”µÄº¬Òå,ÎÒÏëÒÔǰÄÇЩÌÖÂÛÕâ¸ö»°ÌâµÄÈ˵±È»ÈÏΪÕâ¸ö¿ìÊÇÖ¸³ÌÐòµÄÔËÐÐËÙ¶È,ÖÁÓÚ”Èí¼þ¿ª·¢ËÙ¶È”¿ÖÅÂÏëҲûÏë,»òÐíÈÏΪÈí¼þ¿ª·¢ËٶȺÍÕâ¸ö»°Ìâ³¶²»ÉÏÒ»µã¹ØÏµ.ÄÇôÕâ¸öÎÊÌâÔÚÍøÉÏËÑËÑ,ËѵÄÒ»´ó¶Ñ,ÄÇЩc/c++ÕóÓªµÄÁÐÁ˺ܶàÀý×ÓÀ´ËµÃ÷c/c++¿ì, javaÕóÓªµÄÒ²ÊÇÈç´ ......