完整的编译包(android平台):  链接:http://pan.baidu.com/s/1qXMTT7I   密码:2bow

/*
* ALSA parameter test program
*
* Copyright (c) 2007 Volker Schatz (alsacap at the domain volkerschatz.com)
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
* SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
* RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
* CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
* compile with: gcc -o alsacap alsacap.c -lasound
*/ /*============================================================================
Includes
============================================================================*/ #include <stdlib.h>
#include <stdio.h>
#include <alsa/asoundlib.h>
#include <errno.h>
#include <string.h>
#include <dlfcn.h>
#include <sched.h>
#include <getopt.h>
#include <sys/time.h>
#include <math.h> /*============================================================================
Constant and type definitions
============================================================================*/ #define RATE_KHZ_LIMIT 200 #define HWP_END 0
#define HWP_RATE 1
#define HWP_NCH 2
#define HWP_FORMAT 3
#define SIZE_HWP 7 typedef struct {
int recdevices, verbose, card, dev;
char *device;
int hwparams[SIZE_HWP];
}
aiopts; /*============================================================================
Global variables
============================================================================*/ static snd_ctl_t *handle= NULL;
static snd_pcm_t *pcm= NULL;
static snd_ctl_card_info_t *info;
static snd_pcm_info_t *pcminfo;
static snd_pcm_hw_params_t *pars;
static snd_pcm_format_mask_t *fmask; /*============================================================================
Prototypes
============================================================================*/ void usagemsg(int code);
void errnumarg(char optchar);
void errarg(char optchar);
void errtoomany(); void scancards(snd_pcm_stream_t stream, int thecard, int thedev);
int sc_errcheck(int retval, const char *doingwhat, int cardnr, int devnr); void testconfig(snd_pcm_stream_t stream, const char *device, const int *hwpars);
void tc_errcheck(int retval, const char *doingwhat); const char *alsaerrstr(const int errcode);
const char *dirstr(int dir); int parse_alsaformats(const char *fmtstr);
const char *alsafmtstr(int fmtnum); void printfmtmask(const snd_pcm_format_mask_t *fmask); /*============================================================================
Main program
============================================================================*/ int main(int argc, char **argv)
{
aiopts options= { , , -, -, NULL };
snd_pcm_stream_t stream;
char *argpar;
int argind, hwpind; snd_ctl_card_info_alloca(&info);
snd_pcm_info_alloca(&pcminfo);
snd_pcm_hw_params_alloca(&pars);
snd_pcm_format_mask_alloca(&fmask); hwpind= ;
for( argind= ; argind< argc; ++argind )
{
if( argv[argind][]!='-' ) {
fprintf(stderr, "Unrecognised command-line argument `%s'.\n", argv[argind]);
usagemsg();
}
if( argv[argind][] ) argpar= argv[argind]+;
else {
if( argind+ >= argc ) argpar= NULL;
else argpar= argv[argind+];
}
if( argv[argind][]=='h' || !strcmp(argv[argind]+, "-help") )
usagemsg();
else if( argv[argind][]=='R' ) {
options.recdevices= ;
argpar= NULL; // set to NULL if unused to keep track of next arg index
}
else if( argv[argind][]=='C' ) {
if( !argpar || !isdigit(*argpar) ) errnumarg('C');
options.card= strtol(argpar, NULL, );
}
else if( argv[argind][]=='D' ) {
if( !argpar || !isdigit(*argpar) ) errnumarg('D');
options.dev= strtol(argpar, NULL, );
}
else if( argv[argind][]=='d' ) {
if( !argpar ) errarg('d');
options.device= argpar;
}
else if( argv[argind][]=='r' ) {
if( !argpar || !isdigit(*argpar) ) errnumarg('r');
if( hwpind+ > SIZE_HWP ) errtoomany();
options.hwparams[hwpind++]= HWP_RATE;
options.hwparams[hwpind]= strtol(argpar, NULL, );
if( options.hwparams[hwpind] <= RATE_KHZ_LIMIT )
options.hwparams[hwpind] *= ; // sanity check: Hz or kHz ?
++hwpind;
}
else if( argv[argind][]=='c' ) {
if( !argpar || !isdigit(*argpar) ) errnumarg('c');
if( hwpind+ > SIZE_HWP ) errtoomany();
options.hwparams[hwpind++]= HWP_NCH;
options.hwparams[hwpind++]= strtol(argpar, NULL, );
}
else if( argv[argind][]=='f' ) {
if( !argpar ) errarg('f');
if( hwpind+ > SIZE_HWP ) errtoomany();
options.hwparams[hwpind++]= HWP_FORMAT;
options.hwparams[hwpind++]= parse_alsaformat(argpar);
}
else {
fprintf(stderr, "Unrecognised command-line option `%s'.\n", argv[argind]);
usagemsg();
}
if( argpar && !argv[argind][] )
++argind; // additional increment if separate parameter argument was used
}
options.hwparams[hwpind]= HWP_END;
if( options.dev >= && options.card < ) {
fprintf(stderr, "The card has to be specified with -C if a device number is given (-D).\n");
exit();
}
if( options.device && (options.card>= || options.dev>=) ) {
fprintf(stderr, "Specifying a device name (-d) and a card and possibly device number (-C, -D) is mutually exclusive.\n");
exit();
}
stream= options.recdevices? SND_PCM_STREAM_CAPTURE : SND_PCM_STREAM_PLAYBACK; if( !options.device )
scancards(stream, options.card, options.dev);
else
testconfig(stream, options.device, options.hwparams); return ; } /*============================================================================
Usage message and command-line argument error functions
============================================================================*/ void usagemsg(int code)
{
fprintf(stderr, "Usage: alsacap [-R] [-C <card #> [-D <device #>]]\n"
" alsacap [-R] -d <device name> [-r <rate>|-c <# of channels>|-f <sample format>]...\n"
"ALSA capability lister.\n"
"First form: Scans one or all soundcards known to ALSA for devices, \n"
"subdevices and parameter ranges. -R causes a scan for recording\n"
"rather than playback devices. The other options specify the sound\n"
"card and possibly the device by number.\n"
"Second form: Displays ranges of configuration parameters for the given\n"
"ALSA device. Unlike with the first form, a non-hardware device may be\n"
"given. Up to three optional command-line arguments fix the rate,\n"
"number of channels and sample format in the order in which they are\n"
"given. The remaining parameter ranges are output. If unique, the\n"
"number of significant bits of the sample values is output. (Some\n"
"sound cards ignore some of the bits.)\n");
exit(code);
} void errnumarg(char optchar)
{
fprintf(stderr, "The -%c option requires a numerical argument! Aborting.\n", optchar);
exit();
} void errarg(char optchar)
{
fprintf(stderr, "The -%c option requires an argument! Aborting.\n", optchar);
exit();
} void errtoomany()
{
fprintf(stderr, "Too many -r/-c/-f options given! (Maximum is %d.) Aborting.\n", (SIZE_HWP-)/);
exit();
} /*============================================================================
Function for scanning all cards
============================================================================*/ #define HWCARDTEMPL "hw:%d"
#define HWDEVTEMPL "hw:%d,%d"
#define HWDEVLEN 32 void scancards(snd_pcm_stream_t stream, int thecard, int thedev)
{
char hwdev[HWDEVLEN+];
unsigned min, max;
int card, err, dev, subd, nsubd; printf("*** Scanning for %s devices", stream==SND_PCM_STREAM_CAPTURE? "recording" : "playback");
if( thecard >= )
printf(" on card %d", thecard);
if( thedev >= )
printf(", device %d", thedev);
printf(" ***\n");
hwdev[HWDEVLEN]= ;
if( thecard >= )
card= thecard;
else {
card= -;
if( snd_card_next(&card) < )
return;
}
while( card >= )
{
snprintf(hwdev, HWDEVLEN, HWCARDTEMPL, card);
err= snd_ctl_open(&handle, hwdev, );
if( sc_errcheck(err, "opening control interface", card, -) ) goto nextcard;
err= snd_ctl_card_info(handle, info);
if( sc_errcheck(err, "obtaining card info", card, -) ) {
snd_ctl_close(handle);
goto nextcard;
}
printf("Card %d, ID `%s', name `%s'\n", card, snd_ctl_card_info_get_id(info),
snd_ctl_card_info_get_name(info));
if( thedev >= )
dev= thedev;
else {
dev= -;
if( snd_ctl_pcm_next_device(handle, &dev) < ) {
snd_ctl_close(handle);
goto nextcard;
}
}
while( dev >= )
{
snd_pcm_info_set_device(pcminfo, dev);
snd_pcm_info_set_subdevice(pcminfo, );
snd_pcm_info_set_stream(pcminfo, stream);
err= snd_ctl_pcm_info(handle, pcminfo);
if( thedev< && err == -ENOENT ) goto nextdev;
if( sc_errcheck(err, "obtaining device info", card, dev) ) goto nextdev;
nsubd= snd_pcm_info_get_subdevices_count(pcminfo);
if( sc_errcheck(nsubd, "obtaining device info", card, dev) ) goto nextdev;
printf(" Device %d, ID `%s', name `%s', %d subdevices (%d available)\n",
dev, snd_pcm_info_get_id(pcminfo), snd_pcm_info_get_name(pcminfo),
nsubd, snd_pcm_info_get_subdevices_avail(pcminfo));
snprintf(hwdev, HWDEVLEN, HWDEVTEMPL, card, dev);
err= snd_pcm_open(&pcm, hwdev, stream, SND_PCM_NONBLOCK);
if( sc_errcheck(err, "opening sound device", card, dev) ) goto nextdev;
err= snd_pcm_hw_params_any(pcm, pars);
if( sc_errcheck(err, "obtaining hardware parameters", card, dev) ) {
snd_pcm_close(pcm);
goto nextdev;
}
snd_pcm_hw_params_get_channels_min(pars, &min);
snd_pcm_hw_params_get_channels_max(pars, &max);
if( min == max )
if( min == ) printf(" 1 channel, ");
else printf(" %d channels, ", min);
else printf(" %u..%u channels, ", min, max);
snd_pcm_hw_params_get_rate_min(pars, &min, NULL);
snd_pcm_hw_params_get_rate_max(pars, &max, NULL);
printf("sampling rate %u..%u Hz\n Sample formats: ", min, max);
snd_pcm_hw_params_get_format_mask(pars, fmask);
printfmtmask(fmask);
snd_pcm_close(pcm);
printf("\n");
pcm= NULL;
for( subd= ; subd< nsubd; ++subd ) {
snd_pcm_info_set_subdevice(pcminfo, subd);
err= snd_ctl_pcm_info(handle, pcminfo);
if( sc_errcheck(err, "obtaining subdevice info", card, dev) ) goto nextdev;
printf(" Subdevice %d, name `%s'\n", subd, snd_pcm_info_get_subdevice_name(pcminfo));
}
nextdev:
if( thedev >= || snd_ctl_pcm_next_device(handle, &dev) < )
break;
}
snd_ctl_close(handle);
nextcard:
if( thecard >= || snd_card_next(&card) < )
break;
}
} int sc_errcheck(int retval, const char *doingwhat, int cardnr, int devnr)
{
if( retval< ) {
if( devnr>= )
fprintf(stderr, "Error %s for card %d, device %d: %s. Skipping.\n", doingwhat, cardnr, devnr, alsaerrstr(retval));
else
fprintf(stderr, "Error %s for card %d: %s. Skipping.\n", doingwhat, cardnr, alsaerrstr(retval));
return ;
}
return ;
} /*============================================================================
Function for investigating device configurations
============================================================================*/ void testconfig(snd_pcm_stream_t stream, const char *device, const int *hwpars)
{
unsigned min, max, param;
int err, count, dir, result; printf("*** Exploring configuration space of device `%s' for %s ***\n", device,
stream==SND_PCM_STREAM_CAPTURE? "recording" : "playback");
err= snd_pcm_open(&pcm, device, stream, SND_PCM_NONBLOCK);
tc_errcheck(err, "opening sound device");
err= snd_pcm_hw_params_any(pcm, pars);
tc_errcheck(err, "initialising hardware parameters");
for( count= ; hwpars[count]!=HWP_END; count += ) switch(hwpars[count])
{
case HWP_RATE:param= hwpars[count+];
err= snd_pcm_hw_params_set_rate_near(pcm, pars, &param, &result);
if( err< )
fprintf(stderr, "Could not set sampling rate to %d Hz: %s. "
"Continuing regardless.\n", hwpars[count+], alsaerrstr(err));
else
printf("Set sampling rate %d Hz --> got %u Hz, %s requested.\n", hwpars[count+], param, dirstr(dir));
break;
case HWP_NCH:err= snd_pcm_hw_params_set_channels(pcm, pars, hwpars[count+]);
if( err< )
fprintf(stderr, "Could not set # of channels to %d: %s. "
"Continuing regardless.\n", hwpars[count+], alsaerrstr(err));
else
printf("Set number of channels to %d.\n", hwpars[count+]);
break;
case HWP_FORMAT:err= snd_pcm_hw_params_set_format(pcm, pars, hwpars[count+]);
if( err< )
fprintf(stderr, "Could not set sample format to %s: %s."
" Continuing regardless.\n", alsafmtstr(hwpars[count+]), alsaerrstr(err));
else
printf("Set sample format to %s.\n", alsafmtstr(hwpars[count+]));
break;
default:
break;
}
if( count> )
printf("Parameter ranges remaining after these settings:\n");
snd_pcm_hw_params_get_channels_min(pars, &min);
snd_pcm_hw_params_get_channels_max(pars, &max);
if( min==max )
if( min== )
printf("1 channel\n");
else
printf("%u channels\n", min);
else
printf("%u..%u channels\n", min, max);
snd_pcm_hw_params_get_rate_min(pars, &min, NULL);
snd_pcm_hw_params_get_rate_max(pars, &max, NULL);
if( min==max )
printf("Sampling rate %u Hz\nSample formats: ", min);
else
printf("Sampling rate %u..%u Hz\nSample formats: ", min, max);
snd_pcm_hw_params_get_format_mask(pars, fmask);
printfmtmask(fmask);
printf("\n");
result= snd_pcm_hw_params_get_sbits(pars);
if( result >= ) // only available if bit width of all formats is the same
printf("Significant bits: %d\n", result);
snd_pcm_close(pcm);
} void tc_errcheck(int retval, const char *doingwhat)
{
if( retval< ) {
fprintf(stderr, "Error %s: %s. Aborting.\n", doingwhat, alsaerrstr(retval));
if( pcm )
snd_pcm_close(pcm);
exit();
}
} /*============================================================================
String-building functions
============================================================================*/ struct alsaerr { int err; char *msg; };
struct alsaerr aelist[]= {
-EBADFD, "PCM device is in a bad state",
-EPIPE, "An underrun occurred",
-ESTRPIPE, "A suspend event occurred",
-ENOTTY, "Hotplug device has been removed",
-ENODEV, "Hotplug device has been removed",
-ENOENT, "Device does not exist",
, NULL
};
const char *alsaerrstr(const int errcode)
{
struct alsaerr *search; if( errcode >= )
return "No error";
for( search= aelist; search->msg && search->err!=errcode; ++search);
if( search->msg )
return search->msg;
else
return strerror(-errcode);
} const char *dirstr(int dir)
{
if( !dir )
return "=";
else if( dir< )
return "<";
else
return ">";
} /*============================================================================
Functions for parsing and string output of ALSA sample formats
============================================================================*/ struct fmtdef { char *fmtname; int format; };
static struct fmtdef fmtlist[]= {
"S8", SND_PCM_FORMAT_S8,
"U8", SND_PCM_FORMAT_U8,
"S16_LE", SND_PCM_FORMAT_S16_LE,
"S16_BE", SND_PCM_FORMAT_S16_BE,
"U16_LE", SND_PCM_FORMAT_U16_LE,
"U16_BE", SND_PCM_FORMAT_U16_BE,
"S24_LE", SND_PCM_FORMAT_S24_LE,
"S24_BE", SND_PCM_FORMAT_S24_BE,
"U24_LE", SND_PCM_FORMAT_U24_LE,
"U24_BE", SND_PCM_FORMAT_U24_BE,
"S32_LE", SND_PCM_FORMAT_S32_LE,
"S32_BE", SND_PCM_FORMAT_S32_BE,
"U32_LE", SND_PCM_FORMAT_U32_LE,
"U32_BE", SND_PCM_FORMAT_U32_BE,
"FLOAT_LE", SND_PCM_FORMAT_FLOAT_LE,
"FLOAT_BE", SND_PCM_FORMAT_FLOAT_BE,
"FLOAT64_LE", SND_PCM_FORMAT_FLOAT64_LE,
"FLOAT64_BE", SND_PCM_FORMAT_FLOAT64_BE,
"IEC958_SUBFRAME_LE", SND_PCM_FORMAT_IEC958_SUBFRAME_LE,
"IEC958_SUBFRAME_BE", SND_PCM_FORMAT_IEC958_SUBFRAME_BE,
"MU_LAW", SND_PCM_FORMAT_MU_LAW,
"A_LAW", SND_PCM_FORMAT_A_LAW,
"IMA_ADPCM", SND_PCM_FORMAT_IMA_ADPCM,
"MPEG", SND_PCM_FORMAT_MPEG,
"GSM", SND_PCM_FORMAT_GSM,
"SPECIAL", SND_PCM_FORMAT_SPECIAL,
"S24_3LE", SND_PCM_FORMAT_S24_3LE,
"S24_3BE", SND_PCM_FORMAT_S24_3BE,
"U24_3LE", SND_PCM_FORMAT_U24_3LE,
"U24_3BE", SND_PCM_FORMAT_U24_3BE,
"S20_3LE", SND_PCM_FORMAT_S20_3LE,
"S20_3BE", SND_PCM_FORMAT_S20_3BE,
"U20_3LE", SND_PCM_FORMAT_U20_3LE,
"U20_3BE", SND_PCM_FORMAT_U20_3BE,
"S18_3LE", SND_PCM_FORMAT_S18_3LE,
"S18_3BE", SND_PCM_FORMAT_S18_3BE,
"U18_3LE", SND_PCM_FORMAT_U18_3LE,
"U18_3BE", SND_PCM_FORMAT_U18_3BE,
"S16", SND_PCM_FORMAT_S16,
"U16", SND_PCM_FORMAT_U16,
"S24", SND_PCM_FORMAT_S24,
"U24", SND_PCM_FORMAT_U24,
"S32", SND_PCM_FORMAT_S32,
"U32", SND_PCM_FORMAT_U32,
"FLOAT", SND_PCM_FORMAT_FLOAT,
"FLOAT64", SND_PCM_FORMAT_FLOAT64,
"IEC958_SUBFRAME", SND_PCM_FORMAT_IEC958_SUBFRAME,
NULL,
}; int parse_alsaformat(const char *fmtstr)
{
struct fmtdef *search; for( search= fmtlist; search->fmtname && strcmp(search->fmtname, fmtstr); ++search );
if( !search->fmtname ) {
fprintf(stderr, "Unknown sample format `%s'. Aborting.\n", fmtstr);
exit();
}
return search->format;
} const char *alsafmtstr(int fmtnum)
{
struct fmtdef *search; for( search= fmtlist; search->fmtname && search->format!=fmtnum; ++search );
if( !search->fmtname )
return "(unknown)";
else
return search->fmtname;
} /*============================================================================
Printout functions
============================================================================*/ void printfmtmask(const snd_pcm_format_mask_t *fmask)
{
int fmt, prevformat= ; for( fmt= ; fmt <= SND_PCM_FORMAT_LAST; ++fmt )
if( snd_pcm_format_mask_test(fmask, (snd_pcm_format_t)fmt) ) {
if( prevformat )
printf(", ");
printf("%s", snd_pcm_format_name((snd_pcm_format_t)fmt));
prevformat= ;
}
if( !prevformat )
printf("(none)");
}

Android : 获取声卡信息的测试代码的更多相关文章

  1. I.MX6 android 获取framebuffer信息

    /******************************************************************************** * I.MX6 android 获取 ...

  2. Android 获取手机信息,设置权限,申请权限,查询联系人,获取手机定位信息

    Android 获取手机信息,设置权限,申请权限,查询联系人,获取手机定位信息 本文目录: 获取手机信息 设置权限 申请权限 查询联系人 获取手机定位信息 调用高德地图,设置显示2个坐标点的位置,以及 ...

  3. 拖放获取文件信息的bat代码

    参考:岁月如歌-通过拖曳获取文件信息的bat代码 拖放获取文件信息的bat代码 使用命令行配合7z解压文件时由于每次解压的文件不同,因此搜索了一下拖放识别文件信息的方法,以此方式来减轻工作量 获取文件 ...

  4. Android获取位置信息的方法总结

    1.位置服务的简介:位置服务,英文翻译为Location-Based Services,缩写为LBS,又称为定位服务或基于位置的服务,融合了GPS定位.移动通信.导航等多种技术,提供与空间位置相关的综 ...

  5. Android 获取内存信息

    由于工作需要,研究了一下android上获取内存信息的方法,总结如下: 1.SDK获取 在Java层利用API获取很简单,直接使用ActivityManager.MemoryInfo类即可,代码如下: ...

  6. Android 获取地理位置信息 封装好了 直接用

    前言:花了一个早上研究了以下android获取经纬度,然后网上的参考资料都是杂七杂八,基本上都是过去几年的,现在我用 android6.0参照别人的结果发生好多错误,我的内心几乎是崩溃的.后来,不断百 ...

  7. android 获取IMSI信息(判断是移动,联通,电信手机卡)

    首先我们需要知道手机IMSI号前面3位460是国家,紧接着后面2位00 02是中国移动,01是中国联通,03是中国电信.那么第一步就是先获取手机IMSI号码:代码如下 /** *获取IMSI信息 * ...

  8. Android 获取设备信息 异常

    /**获取设备信息 * @param c * @return */ public static void setDeviceInfo(Context c,RequestParams params){ ...

  9. android 获取手机信息工具类

    package com.yqy.yqy_listviewheadview; import android.content.Context; import android.telephony.Telep ...

随机推荐

  1. Ubuntu16.04安装8821CE 无线网卡无驱动

    已解决 参考链接:https://unix.stackexchange.com/question ... -mint-18-2 内容 Worked solution (Requirements: ke ...

  2. 雷林鹏分享:XML 总结 下一步学习什么呢?

    XML 总结 下一步学习什么呢? XML 总结 XML 可用于交换.共享和存储数据. XML 文档形成 树状结构,在"根"和"叶子"的分支机构开始的. XML ...

  3. 20180831xlVBA_WorkbooksCosolidate

    Sub WorkbooksConsolidate() Rem 设置求和区域为 sheet名称/单元格区域;sheet名称/单元格区域 Const Setting As String = "S ...

  4. Educational Codeforces Round 48 (Rated for Div. 2)G. Appropriate Team

    题意:求满足条件的(i,j)对数:\(gcd(v,a_i)=x,lcm(v,a_j)=y\) 题解:\(x|a_i,a_j|y\),\(x|y\),考虑质因子p,假设a_i中p次数为a,x中次数为b, ...

  5. 解决Requests中文乱码【有用】,读取htm文件 读取txt文件报错:UnicodeDecodeError: 'utf-8' codec can't decode byte 0xc8 in position 0

    打开这个网址https://blog.csdn.net/chaowanghn/article/details/54889835 python在open读取txt文件时,出现UnicodeDecodeE ...

  6. 6月5 Smarty变量调节器

    变量调节器:<{$a|变量调节器}> 主要修改此页面的信息来了解变量调节器:test0605/main.php和模板文件:main0605.html 1.利用给定的变量调节器 capita ...

  7. 【PowerDesigner】【4】连接数据库并生成ER图

    文字版: 1,File→Reverse Engineer→Database...., 2,新窗口database reverse engineering打开后,填写名称(Model name),选择数 ...

  8. 详解 java socket

    一,网络编程中两个主要的问题 一个是如何准确的定位网络上一台或多台主机,另一个就是找到主机后如何可靠高效的进行数据传输. 在TCP/IP协议中IP层主要负责网络主机的定位,数据传输的路由,由IP地址可 ...

  9. 牛客练习赛30-A/C

    链接:https://ac.nowcoder.com/acm/contest/216/A来源:牛客网 时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 32768K,其他语言65536K ...

  10. 十六、JAVA基础(堆和栈)

    一.堆和栈 堆和栈都是JAVA中的存储结构,也就是说,都是内存中存放数据的地方. 1.堆:(存放由new创建的对象和数组) 引用类型的变量,内存分配一般在堆上或者常量池(字符串常量,基本数据类型常量) ...