怎么把one一个上的文章excel转换成长图片片

如何样快速获得图片的大小_强制类型转换有关问题,带代码,顶帖就给分,求解答,麻烦了,多谢_怎么阅读大型项目源码心得__脚本百事通
稍等,加载中……
^_^请注意,有可能下面的2篇文章才是您想要的内容:
如何样快速获得图片的大小
强制类型转换有关问题,带代码,顶帖就给分,求解答,麻烦了,多谢
怎么阅读大型项目源码心得
如何样快速获得图片的大小
怎么样快速获得图片的大小我想用image显示图片的缩略图。如果我把strech属性设为true。可以显示缩略图,但是完全是拉伸的。我想先获得图片的大小,再动态修改image的大小。
Dim objpic, iWidth, iHeight
Set objpic = LoadPicture("F:\photo\S1055561.JPG")
iWidth = Round(objpic.Width / 26.4583)
iHeight = Round(objpic.Height / 26.4583)Picture1.Picture = LoadPicture("F:\photo\S1055561.JPG")MsgBox "高" & Picture1.Picture.Height & "宽" & Picture1.Picture.Width这两种方法可以获得图片的大小,但是很慢啊。有没有快一点的方法?------解决方案--------------------参考:http://download.csdn.net/source/2317047
------解决方案--------------------不懂,up
------解决方案--------------------直接用API读取。比如:位图文件的高和宽在文件开头,定义一个结构可以读取。
------解决方案--------------------不懂,up
------解决方案--------------------每一个中图像文件都有一个地方保存了图像的大小的,你需要找到这个位置并读取相关参数就OK了至于先用LoadPicture读取在来得到高度那是自杀。Public Type ImageSize
Width As Long
Height As LongEnd TypePublic Function GetImageSize(sFileName As String) As ImageSize
On Error Resume Next
'you'll want to change this
Dim iFN As Integer
Dim bTemp(3) As Byte
Dim lFlen As Long
Dim lPos As Long
Dim bHmsb As Byte
Dim bHlsb As Byte
Dim bWmsb As Byte
Dim bWlsb As Byte
Dim bBuf(7) As Byte
Dim bDone As Byte
Dim iCount As Integer
lFlen = FileLen(sFileName)
iFN = FreeFile
Open sFileName For Binary As iFN
Get #iFN, 1, bTemp()
If bTemp(0) = &H89 And bTemp(1) = &H50 And bTemp(2) = &H4E _
And bTemp(3) = &H47 Then
Get #iFN, 19, bWmsb
Get #iFN, 20, bWlsb
Get #iFN, 23, bHmsb
Get #iFN, 24, bHlsb
GetImageSize.Width = CombineBytes(bWlsb, bWmsb)
GetImageSize.Height = CombineBytes(bHlsb, bHmsb)
If bTemp(0) = &H47 And bTemp(1) = &H49 And bTemp(2) = &H46 _
And bTemp(3) = &H38 Then
Get #iFN, 7, bWlsb
Get #iFN, 8, bWmsb
Get #iFN, 9, bHlsb
Get #iFN, 10, bHmsb
GetImageSize.Width = CombineBytes(bWlsb, bWmsb)
GetImageSize.Height = CombineBytes(bHlsb, bHmsb)
'JPEG file
If bTemp(0) = &HFF And bTemp(1) = &HD8 And bTemp(2) = &HFF Then
Debug.Print "JPEG"
Get #iFN, lPos, bBuf(1)
Get #iFN, lPos + 1, bBuf(2)
lPos = lPos + 1
Loop Until (bBuf(1) = &HFF And bBuf(2) && &HFF) Or lPos & lFlen
For iCount = 0 To 7
Get #iFN, lPos + iCount, bBuf(iCount)
Next iCount
If bBuf(0) &= &HC0 And bBuf(0) &= &HC3 Then
bHmsb = bBuf(4)
bHlsb = bBuf(5)
bWmsb = bBuf(6)
bWlsb = bBuf(7)
lPos = lPos + (CombineBytes(bBuf(2), bBuf(1))) + 1
Loop While lPos & lFlen And bDone = 0
GetImageSize.Width = CombineBytes(bWlsb, bWmsb)
GetImageSize.Height = CombineBytes(bHlsb, bHmsb)
Close iFNEnd FunctionPrivate Function CombineBytes(lsb As Byte, msb As Byte) As Long
CombineBytes = CLng(lsb + (msb * 256))End Function------解决方案--------------------
我也支持读文件头不过文件格式太多啦.........
------解决方案--------------------Shell("alchemy.exe -x F:\photo\S1055561.JPG &c:\imginfo.txt",vbHide)'然后读文件c:\imginfo.txt的内容Image Alchemy (v1.11) - Copyright (c) 1990-98, Handmade Software, Inc.Reading JPEG file F:\photo\S1055561.JPGFile Name: F:\photo\S1055561.JPG Width x Height: 2008 x 1280 Number of Colours: True Colour (24 bits) Dots per inch: 600 x 600 Image size (inches): 3.35 x 2.13 Raw size: 7710720
Actual size: 159466
(Compression ratio: 48.4:1)
------解决方案--------------------VB code
Option Explicit
Private Declare Function GetObject Lib "gdi32" Alias "GetObjectA" (ByVal hObject As Long, ByVal nCount As Long, lpObject As Any) As Long
'定义位图结构
Private Type BITMAP
bmType As Long
bmWidth As Long
bmHeight As Long
bmWidthBytes As Long
bmPlanes As Integer
bmBitsPixel As Integer
bmBits As Long
'定义位图大小
Private Type PicInfo
PicWidth As Long
picHeight As Long
Private Function GetPictureInfo(lsPicName As String) As PicInfo
Dim hBitmap As Long
Dim res As Long
Dim bmp As BITMAP
res = GetObject(LoadPicture(lsPicName).Handle, Len(bmp), bmp) '取得BITMAP的结构
GetPictureInfo.PicWidth = bmp.bmWidth
GetPictureInfo.picHeight = bmp.bmHeight
End Function
Private Sub Command1_Click()
Debug.Print "图片宽度:" & GetPictureInfo("c:\player2.JPG").PicWidth, "图片高度:" & GetPictureInfo("c:\player2.JPG").picHeight
------解决方案--------------------在网上搜的,好像挺快的,直接读信息的
Option Explicit
Private Type ImageSize
Width As Long
Height As Long
Private Function GetImageSize(sFileName As String) As ImageSize
On Error Resume Next
Dim iFN As Integer
Dim bTemp(3) As Byte
Dim lFlen As Long
Dim lPos As Long
Dim bHmsb As Byte
Dim bHlsb As Byte
Dim bWmsb As Byte
Dim bWlsb As Byte
Dim bBuf(7) As Byte
Dim bDone As Byte
Dim iCount As Integer
lFlen = FileLen(sFileName)
iFN = FreeFile
Open sFileName For Binary As iFN
Get #iFN, 1, bTemp()
If bTemp(0) = &H89 And bTemp(1) = &H50 And bTemp(2) = &H4E And bTemp(3) = &H47 Then
Get #iFN, 19, bWmsb
Get #iFN, 20, bWlsb
Get #iFN, 23, bHmsb
Get #iFN, 24, bHlsb
GetImageSize.Width = CombineBytes(bWlsb, bWmsb)
GetImageSize.Height = CombineBytes(bHlsb, bHmsb)
If bTemp(0) = &H47 And bTemp(1) = &H49 And bTemp(2) = &H46 And bTemp(3) = &H38 Then
Get #iFN, 7, bWlsb
Get #iFN, 8, bWmsb
Get #iFN, 9, bHlsb
Get #iFN, 10, bHmsb
GetImageSize.Width = CombineBytes(bWlsb, bWmsb)
GetImageSize.Height = CombineBytes(bHlsb, bHmsb)
'JPEG 文件
If bTemp(0) = &HFF And bTemp(1) = &HD8 And bTemp(2) = &HFF Then
Debug.Print "JPEG"
Get #iFN, lPos, bBuf(1)
Get #iFN, lPos + 1, bBuf(2)
lPos = lPos + 1
Loop Until (bBuf(1) = &HFF And bBuf(2) && &HFF) Or lPos & lFlen
For iCount = 0 To 7
Get #iFN, lPos + iCount, bBuf(iCount)
Next iCount
If bBuf(0) &= &HC0 And bBuf(0) &= &HC3 Then
bHmsb = bBuf(4)
bHlsb = bBuf(5)
bWmsb = bBuf(6)
bWlsb = bBuf(7)
lPos = lPos + (CombineBytes(bBuf(2), bBuf(1))) + 1
Loop While lPos & lFlen And bDone = 0
GetImageSize.Width = CombineBytes(bWlsb, bWmsb)
GetImageSize.Height = CombineBytes(bHlsb, bHmsb)
If bTemp(0) = &H42 And bTemp(1) = &H4D Then
Get #iFN, 19, bWlsb
Get #iFN, 20, bWmsb
Get #iFN, 23, bHlsb
Get #iFN, 24, bHmsb
GetImageSize.Width = CombineBytes(bWlsb, bWmsb)
GetImageSize.Height = CombineBytes(bHlsb, bHmsb)
End Function
Private Function CombineBytes(lsb As Byte, msb As Byte) As Long
CombineBytes = CLng(lsb + (msb * 256)) '把十六进制数换成十进制
End Function
Private Sub Command1_Click()
Dim size As ImageSize
size = GetImageSize("F:\photo\S1055561.JPG")
MsgBox "width=" & size.Width & " height=" & size.Height
------解决方案--------------------chenjl1031 的代码说的不好听点就是脱了裤子放屁。还有那个代码可能存在资源泄漏,LoadPicture(lsPicName)所加载的对象没有被释放,在一个问题时GetObject 在有些情况下得不到正确的值。------解决方案--------------------
chenjl1031 的代码说的不好听点就是脱了裤子放屁。还有那个代码可能存在资源泄漏,LoadPicture(lsPicName)所加载的对象没有被释放,在一个问题时GetObject 在有些情况下得不到正确的值。
------解决方案--------------------这些你只要找一下这些格式的文件头的说明文件,不都是很容易的一件事情吗EMF的'typedef struct tagENHMETAHEADER'{'
// Record type EMR_HEADER.'
// Record size in bytes. This may be greater'
// than the sizeof(ENHMETAHEADER).'
// Inclusive-inclusive bounds in device units.'
// Inclusive-inclusive Picture Frame of'
// metafile in .01 mm units.'
// Signature.
Must be ENHMETA_SIGNATURE.''
// Version number.'
// Size of the metafile in bytes.'
// Number of records in the metafile.'
// Number of handles in the handle table.'
// Handle index zero is reserved.'
// Reserved.
Must be zero.'
// Number of chars in the unicode description string.'
// This is 0 if there is no description string.''
// Offset to the metafile description record.'
// This is 0 if there is no description string.'
// Number of entries in the metafile palette.'
// Size of the reference device in pixels.'
// Size of the reference device in millimeters.'} ENHMETAHEADER;ICO的Private Type ICONDIRENTRY
bWidth As Byte
图标图片的显示宽度,以像素为单位,最大值为255
bHeight As Byte
图标图片的显示高度, 以像素为单位,最大值为255 (times 2)
bColorCount As Byte
图标图片的颜色数 (0 if &=8bpp)
bReserved As Byte
保留域总是 0
wPlanes As Integer
图标图片的位面数,1
wBitCount As Integer
标图片的颜色深度
dwBytesInRes As Long
图标图片占用的数据量(字节为单位)
dwImageOffset As Long
图标图片的开始位置End TypePrivate Type ICONDIR
idReserved As Integer
保留域,目前始终为0
idType As Integer
定义为资源类型,图标值为 1、光标是2
idCount As Integer
表示的是这个文件里包含了几个图标End TypePCX的Private Type PcxPalette
Red As Byte
Green As Byte
Blue As ByteEnd TypePrivate Type PCXHeader
Manufacturer
'固定为10=ZSoft
'2 = 2.8 with palette
'3 = 2.8 without palette
'4 = Pc paintbrush for windows
'5 = Pc Paintbrush ver 3.0+24位固定为5
'1 = .PCX RLE,固定为1
'1, 2, 4, 8,每像素所需位数
As Integer
'图像相对于屏幕左上角X坐标(像素为单位)
As Integer
'图像相对于屏幕左上角Y坐标(像素为单位)
As Integer
'图像相对于屏幕右下角X坐标(像素为单位)
As Integer
'图像相对于屏幕右下角Y坐标(像素为单位)
HoriResolution
As Integer
'图像水平分辨率(像素/英寸)
VertResolution
As Integer
'图像垂直分辨率(像素/英寸)
Palette(0 To 15)
As PcxPalette
'指明调色板数据,只对16色以下有用
'保留,固定为0
'指定图像色彩平面数,24位真彩色为3个平面
BytesPerLine
As Integer
'图像宽度(字节),且必须为偶数
PaletteType
As Integer
'调色板类型,彩色或单色图像为1,灰度图像为2
HScreenSize
As Integer
'图像的屏幕宽度(像素为单位),0为基准
VScreenSize
As Integer
'图像的屏幕高度(像素为单位),0为基准
Filter(0 To 53)
'保留域,固定为0End TypePSD的Private Type ResolutionInfo
HoriResolution
As Integer
'Horizontal resolution in pixels per inch.
HoriResolutionUnit
'1=display horizontal resolutio2=display horizontal resolution in pixels per cm.
As Integer
'Display width as 1= 2= 3= 4= 5=columns.
VertResolution
As Integer
VertResolutionUnit
HeightUnit
As IntegerEnd TypePrivate Type ThumbNailInfo
'= 1 (kJpegRGB). Also supports kRawRGB (0).
'Width of thumbnail in pixels.
'Height of thumbnail in pixels.
WidthBytes
'Padded row bytes as (width * bitspixel + 31) / 32 * 4.
'Total size as widthbytes * height * planes
CompressdSize
'compressedsize
Size after compression. Used for consistentcy check.
BitPerPixel
As Integer
'= 24. Bits per pixel.
As Integer
'= 1. Number of planes.
'JFIF data in RGB format.End TypePrivate Type PsdHeaderInfo '定义Psd的文件头结构
Signature(0 To 3)
As Integer
'总是等于1
Reserved(0 To 5)
'保留,必须位0
As Integer
'图像中的通道数,可以包含ALPHA通道,有效范围1-24
'图像的高度,有效范围1-30000
'图像的宽度,有效范围1-30000
As Integer
'每个通道所用的位数(1.8.16)
As Integer
'颜色模式,Bitmap=0; Grayscale=1; Indexed=2; RGB=3; CMYK=4; Multichannel=7; Duotone=8; Lab=9End TypePrivate Type PsdColorModeInfo
Palette(767)
As ByteEnd TypePrivate Type PsdImageResourceInfo
As Integer
SizeOfName
PascalName()
Resolution
As ResolutionInfo
As ThumbNailInfoEnd TypePrivate Enum PsdColorModeEnum PSD_BITMAP = 0
' Bitmap image PSD_GRAYSCALE = 1
' Greyscale image PSD_INDEXED = 2
' Indexed image PSD_RGB = 3
' RGB image PSD_CMYK = 4
' CMYK PSD_MULTICHANNEL = 7
' Multichannel image PSD_DUOTONE = 8
' Duotone image PSD_LAB = 9
' Lab imageEnd EnumTGA的' TGA header follows (18 byte structure)' Offset + 0 : 1 byte
ID Length (max of 255 characters th can contain anything)' Offset + 1 : 1 byte
Color Map Type (1=palette included, 0=no palette, other values are reserved)' Offset + 2 : 1 byte
m_Image Type (0,1,2,3,9,10,11,32,33). 0=no img, 1&9=paletted, 2&10=true color, 3&11=Grayscale, 32&33 huffman compressed, 9&10&11 are compressed)
强制类型转换有关问题,带代码,顶帖就给分,求解答,麻烦了,多谢
强制类型转换问题,带代码,顶帖就给分,求解答,麻烦了,谢谢
printf("a=%d\n",a);
printf("x=%f\n",x);
printf("y=%lf\n",y);
printf("b=%f\n",b);
system("pause");
书上这样写,执行b=a+x时,a,x都转换成double型相加,结果为412. (小数点后12个0),再换为b的类型int,得412,最后将412赋给b
1、a为int,x为float,相加的话应该是为什么执行b=a+x时,a,x都转换成double型相加,而不是转成float型相加?
2、为什么最后运行的结果,用dev-c++是57.000000,使用turbo c2.0和3.0的结果却是0.000000,而不是412?
------解决方案--------------------所有与浮点相关的,最后都会转成double进行运算,float+float也是如此。
第二个问题涉及到浮点数和整数的内存表示了,感兴趣可以看
1、补码(整数的内存表示);
2、IEEE 754(浮点数的内存表示);
3、函数调用时,压参方式;
4、可变参数的实现原理。------解决方案--------------------顶个,坐等解答------解决方案--------------------pirntf("%f",(float)a);这样?------解决方案--------------------
所有与浮点相关的,最后都会转成double进行运算,float+float也是如此。
第二个问题涉及到浮点数和整数的内存表示了,感兴趣可以看
1、补码(整数的内存表示);
2、IEEE 754(浮点数的内存表示);
3、函数调用时,压参方式;
4、可变参数的实现原理。
赞同。UP!UP!
补充一点,C语言由于历史原因,float类型在参与任何运算或参数传递时都自动转为double类型。这也说明了为什么printf没有%f和%lf之分。
参考C语言 printf为什么酱紫?------解决方案--------------------对学习编程者的忠告:
眼过千遍不如手过一遍!
书看千行不如手敲一行!
手敲千行不如单步一行!
单步源代码千行不如单步对应汇编一行!
VC调试时按Alt+8、Alt+7、Alt+6和Alt+5,打开汇编窗口、堆栈窗口、内存窗口和寄存器窗口看每句C对应的汇编、单步执行并观察相应堆栈、内存和寄存器变化,这样过一遍不就啥都明白了吗。
对VC来说,所谓‘调试时’就是编译连接通过以后,按F10或F11键单步执行一步以后的时候,或者在某行按F9设了断点后按F5执行停在该断点处的时候。
(Turbo C或Borland C用Turbo Debugger调试,Linux或Unix下用GDB调试时,看每句C对应的汇编并单步执行观察相应内存和寄存器变化。)
“学习用汇编语言写程序”
“VC调试(TC或BC用TD调试)时按Alt+8、Alt+7、Alt+6和Alt+5,打开汇编窗口、堆栈窗口、内存窗口和寄存器窗口看每句C对应的汇编、单步执行并观察相应堆栈、内存和寄存器变化,这样过一遍不就啥都明白了吗。
(Linux或Unix下可以在用GDB调试时,看每句C对应的汇编并单步执行观察相应内存和寄存器变化。)”
不是一回事!
不要迷信书、考题、老师、回帖;
要迷信CPU、编译器、调试器、运行结果。
并请结合“盲人摸太阳”和“驾船出海时一定只带一个指南针。”加以理解。
任何理论、权威、传说、真理、标准、解释、想象、知识……都比不上摆在眼前的事实!
有人说一套做一套,你相信他说的还是相信他做的?
其实严格来说这个世界上古往今来所有人都是说一套做一套,不是吗?
不要写连自己也预测不了结果的代码!
电脑内存只是一个一维二进制字节数组及其对应的二进制地址;
人脑才将电脑内存中的这个一维二进制字节数组及其对应的二进制地址的某些部分看成是整数、有符号数/无符号数、浮点数、复数、英文字母、阿拉伯数字、中文/韩文/法文……字符/字符串、函数、函数参数、堆、栈、数组、指针、数组指针、指针数组、数组的数组、指针的指针、二维数组、字符点阵、字符笔画的坐标、黑白二值图片、灰度图片、彩色图片、录音、视频、指纹信息、身份证信息……------解决方案--------------------First, if either operand is long double, the other is converted to long double.
Otherwise, if either operand is double, the other is converted to double.
Otherwise, if either operand is float, the other is converted to float.
Otherwise, the integral promotions are perfor then, if either operand is unsigned long int, the other is converted to unsigned long int.
Otherwise, if one operand is long int and the other is unsigned int, the effect depends on whether a long int can represent all value if so, the unsigned int operand is c if not, both are converted to unsigned long int.
Otherwise, if one operand is long int, the other is converted to long int.
Otherwise, if either operand is unsigned int, the other is converted to unsigned int.
Otherwise, both operands have type int.------解决方案--------------------追问 但是问什么执行b=a+x;
printf("b=%f\n",b);
运行结果:
x=57.000000
y=57.000000
b=0.000000--------------&这里不应该是0.000000吧。
请按任意键继续. . .
我是在VS2010编译环境运行的结果啊。
求解释啊。------解决方案--------------------
追问 但是问什么执行b=a+x;
printf("b=%f\n",b);
运行结果:
x=57.000000
y=57.000000
b=0.000000--------------&这里不应该是0.000000吧。
请按任意键继续. . .
我是在VS2010编译环境运行的结果啊。
求解释啊。
你的 b 是 int, 在 printf 中按 float 输出------解决方案--------------------那也应该是有值的啊,不是吗?
我在window下试验的时候是没有值,但是我要是在LINUX下是有值的。
但是值也不是正确的。------解决方案--------------------1.在运算时,不同类型要转换成同一类型,自动转换的规则为:
double ←float
int ←char,short
2.这个不太清楚,个人觉得是编译器的原因------解决方案--------------------不要写连自己也预测不了结果的代码------解决方案--------------------C语言本身根据编译,运行的环境不同,对数据类型的定义本身也会不同,自然执行出来的结果也不一样
比如int型,有的环境下是2byte,有的环境下是4byte------解决方案--------------------常量也有类型:
C++ Integer Constants
Integer constants are constant data elements that have no fractional parts or exponents. They always begin with a digit. You can specify integer constants in decimal, octal, or hexadecimal form. They can specify signed or unsigned types and long or short types.
integer-constant :
decimal-constant integer-suffixopt
octal-constant integer-suffixopt
hexadecimal-constant integer-suffixopt
'c-char-sequence'
decimal-constant :
nonzero-digit
decimal-constant digit
octal-constant :
octal-constant octal-digit
hexadecimal-constant :
0x hexadecimal-digit
0X hexadecimal-digit
hexadecimal-constant hexadecimal-digit
nonzero-digit : one of
1 2 3 4 5 6 7 8 9
octal-digit : one of
0 1 2 3 4 5 6 7
hexadecimal-digit : one of
0 1 2 3 4 5 6 7 8 9
a b c d e f
A B C D E F
integer-suffix :
unsigned-suffix long-suffixopt
long-suffix unsigned-suffixopt
unsigned-suffix : one of
long-suffix : one of
64-bit integer-suffix :
To specify integer constants using octal or hexadecimal notation, use a prefix that denotes the base. To specify an integer constant of a given integral type, use a suffix that denotes the type.
To specify a decimal constant, begin the specification with a nonzero digit. For example:
int i = 157;
// Decimal constant
int j = 0198;
// N erroneous octal constant
int k = 0365;
// Leading zero specifies octal constant, not decimal
To specify an octal constant, begin the specification with 0, followed by a sequence of digits in the range 0 through 7. The digits 8 and 9 are errors in specifying an octal constant. For example:
int i = 0377;
// Octal constant
int j = 0397;
// Error: 9 is not an octal digit
To specify a hexadecimal constant, begin the specification with 0x or 0X (the case of the “x” does not matter), followed by a sequence of digits in the range 0 through 9 and a (or A) through f (or F). Hexadecimal digits a (or A) through f (or F) represent values in the range 10 through 15. For example:
int i = 0x3
// Hexadecimal constant
int j = 0X3FFF;
// Equal to i
To specify an unsigned type, use either the u or U suffix. To specify a long type, use either the l or L suffix. For example:
unsigned uVal = 328u;
// Unsigned value
long lVal = 0x7FFFFFL;
// Long value specified
as hex constant
unsigned long ulVal = 0776745
// Unsigned long value
C++ Floating-Point Constants
Floating-point constants specify values that must have a fractional part. These values contain decimal points (.) and can contain exponents.
floating-constant :
fractional-constant exponent-partopt floating-suffixopt
digit-sequence exponent-part floating-suffixopt
fractional-constant :
digit-sequenceopt . digit-sequence
digit-sequence .
exponent-part :
e signopt digit-sequence
E signopt digit-sequence
sign : one of
digit-sequence :
digit-sequence digit
floating-suffix :one of
Floating-point constants have a “mantissa,” which specifies the value of the number, an “exponent,” which specifies the magnitude of the number, and an optional suffix that specifies the constant’s type. The mantissa is specified as a sequence of digits followed by a period, followed by an optional sequence of digits representing the fractional part of the number. For example:
The exponent, if present, specifies the magnitude of the number as a power of 10, as shown in the following example:
If an exponent is present, the trailing decimal point is unnecessary in whole numbers such as 18E0.
Floating-point constants default to type double. By using the suffixes f or l (or F or L — the suffix is not case sensitive), the constant can be specified as float or long double, respectively.
Although long double and double have the same representation, they are not the same type. For example, you can have overloaded functions like
void func( double );
void func( long double );------解决方案--------------------这样也带?????
怎么阅读大型项目源码心得
如何阅读大型项目源码心得以下是我个人方法的一些总结:关于如何阅读源码 个人觉得,规范的项目源码包中的头文件与命名方法都是比较规范的。一些重要函数的声明会在相关头文件中有说明,一般情况下,如果一个.c文件只包含一个头文件,那么这个头文件的命名应该是与.c名字相同。阅读开始前,首先展开一下相关的头文件,先查看相关.c文件用到了哪些函数申明,必要时记录这个函数,并注释说明。 函数的命名规则。规范的项目开发中,函数的命名一般都是以英文单词的缩写,如取每个单词的首字母,或一个单词中的几个字母,有的单词之间是以下划线“_”分隔开来的,记住这些英文单词的意思组合,可以有助于代码的阅读。2、下面是我利用VC6.0工具阅读源代码的方法: 打开VC,“文件”-&“新建”-&“工程”选择“Win32 Console Application”下一步就是导入所有的.c与.h文件了。选中FileView:右键Sourse File,选择Add File To directory:选中所以要添加的.c文件,确定,同样的操作完成Header File的导入:好了, 到此所有*.c.*.h文件已经导入到工程了。下面将我自己总结的如何查找函数的方法列出如下:假如我要寻找:ad.c中的这段代码中的函数定义和申明ad_rec_t *ad_open_sps (int32 samples_per_sec){
E_ERROR("A/D library not implemented\n");
return NULL;}这个.c文件中包含自定义的ad.h和err.h,err.h中一看就明白是一些错误信息提示函数的说明,所以我们可以去ad.h中寻找,右键点击ad.h,选择“open document "ad.h"”我们会发现在头文件中定义了许多宏,还有一些解释编译的语句,如#if...#elif... #endif这是方便平台移植,我们找到我们的平台#elif(linux) 在这里找到了我们所需要的结构体信息,在结构体中我们发现还有一个定义,int32,虽然一看就明白是32位的整形数字,但我们能不能再找到一些其它的数字类型定义呢?我们发现在ad.h这个头文件中还有一个头文件:"s2types.h",我们再去展开这个头文件,发现,这个头文件中定义了一些数据类型的声明: 通过以上由头文件找到相关函数的方法,我们可以想到,是否各.c文件是否可以通过各.c文件中包含的.h文件找到相关的联系呢?如果能把这层关系理清,那么代码的联系结构就清楚了。如果又能理解每个.c程序做了些什么事,那么项目整个流程就清楚了。当然要理解整个流程,相关背景、知识也是必不可少的。 在阅读的过程中发现,阅读一个项目的源码,是从整体往局部的结构来阅读,如一个人站在山顶往下看,要下山去的话,就得找一条路,而这条“路”就是程序的主方向,这样一来,那么目的不就明确了?------解决方案--------------------看Linux源码,我一直用source insight!
强大!------解决方案--------------------我还是习惯用SOURCE INSIGHT3.0 功能很齐全
用时间长了别的都不习惯
------解决方案--------------------
window 用 SOURCE INSIGHT
用 kscope 看
如果您想提高自己的技术水平,欢迎加入本站官方1号QQ群:&&,&&2号QQ群:,在群里结识技术精英和交流技术^_^
本站联系邮箱:}

我要回帖

更多关于 excel转换成长图片 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信