}};
修改为如下即可:
#include
void
main()
//将viod改为void
{char
printf("a%c
b%ctc%ctabcn",c1,c2,c3);
printf("t
b%c
%cn",c4,c5);
}
你的pai函数后面少个}
就这个原因
少个“}”,加到就可以了。
pascal语言中,运行程序后出现提示:synrax error,.expected but end of file found.是什么意思
msg = err_msg;你程序末尾的end.没有写"."
scanf的返回值:语法错误,.被期望但是发现文件结束。
换句不那么绕口的话:你程序末尾的end.没有写"."
输入文件已经结束但是你的程序仍在读取。
比如你要读4个数据,而输入文件里只有3个
scanf是什么函数?
scanf与printf函数一样,都被定义在头文件stdio.h里,因此在使用scanf函数时要加上#include 。它是格式输入函数,即按用户指定的格式从键盘上把数据输入到指定的变量之中。
scanf函数原型:class Employee:public Person{
int scanf( const char format, ... );
scanf()函数是格式化输入函数,它从标准输入设备(键盘) 读取输入的信息。
其调用格式为: scanf("<格式化字符串>",<地址表>);
函数 scanf() 是从标准输入流 stdin 中读内容的通用子程序,可以读入全部固有类型的数据并自动转换成机内形式。
scanf()函数返回成功赋值的数据项数,读到文件末尾出错时则返回EOF。
如:
scanf("%d,%d", &a, &b);
如果a和b都被成功读入,那么scanf的返回值就是2
如果只有a被成功读入,返回值为1
如果a和b都未被成功读入,返回值为0
如果遇到错误或遇到end of file,返回值为EOF。
且返回值为int型.
例:使用scanf函数输入数据。
int % Setting ext=[] forces ALL samples to be read. Otherwise,main()
{int a,b,c;
printf("输入 a, b, cn");
scanf("%d,%d,%d", &a, &b, &c);
printf("a = %d b = %d c = %dn", a, b, c);
fflush(stdin);
return 0;
}注意上面的scanf("%d,%d,%d",&a,&b,&c);中%d,%d,%d之间如果有逗号,在输入数据时也要加逗号,如果去掉逗号,输入时就不用逗号,而用空格、tab键或回车键将各个数据隔开
samba 访问出错
ca% skipping over the sample data.se 17你是在ip20的机器上启动了b服务,然后去连接的200的吗?
你先blcllient-L列一下的共享目录,看是否正常?
C语言出现这个提示是什么意思?
[Error] C:UserslenovoDocumentsC-FreeTemp未命名1.cpp:7: error: `printf' was not declared in this scope的意思是 `printf'里的's'没有被定义
[Warning] C:UserslenovoDocumentsC-FreeTemp未命名1.cpp:8:2: warning: no newline at end of file 是源文件的一行没有回车符造成的
“was not declared in this scope”是一个错误信息,在编译的时候会遇到。其含义为标识符在其出现的地方是未被定义的。
total_bytes = ck.Size; % # bytes in subck该错误出现时,需要根据出现该错误的行号% end of wread()及名称,查找对应名称变量或函数的作用,一般有如下几种可能:
1 忘记定义。写代码的时候疏忽了,导致一些变量直接使用但没有定义。只要对应定义相应的函数或变量即可。
2 拼写错误。写代码的时候,敲错了字符。比如sum敲成了Sum, erage敲成erge等。对应修改即可。
3 作用域不正确。在超出变量和函数的作用域部分使用了该变量或函数。需要通过定义位置,或增加声明的手段,加大变量的作用域使其包含引用位置。
scanf是什么意思?
error(msg);scanf是C语言中的标准输入函数。
函数原型如下:
int scanf( const char format, ... );
其调用格式为: scanf("<格式化字符串>",<地址表>);
举例说明如下:
scanf("%d%d", &a, &b); // 接收用户};从键盘输入的2个整数,分别赋值给变量a,b
还需要注意的就是scanf函数的返回值:
对于 scanf("%d%d", &a, &b);
如果a和b都被成功读入,那么scanf的返回值就是2 ;
如果只有a被成功读入,返回值为1 ;
如果a和b都未被成功读入,返回值为0 ;
如果遇到错误或遇到end of file,返回值为EOF。
本人是初学者,为什么这段VHDL程序会出现这种错误
VHDL的语法还要多学习了
architecture one of and3 is
begin
y<=a and b;
应该是 end one;要分号的
libcase 'ieng'rary ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;
enti% Read format-specific :ty and3 is
port (a,b:in bit;
y:out bit
);
end and3;------------------------------
architecture one of and3 is
begin
y<=a and b;
end one;----------------------------------
end后面少个分号
如何解决编译时出现的fatal error C1004: unexpected end of file found问题
可能你当前的工程配置为需要stdafx.cpnbytes=nbytes+2;p和stdafx.h文件,但你又没这两个文件;可以在编译处选择“不需要预编译头文件”或者自己随便创建这两个文件,然fmt_msg = 'IBM AVC Adaptive Differential';后加入到工程里面
GHOST一键还原到一半出现提示:Unexpected end of file。无法继续,请问怎么解决?在线等!拜托帮帮忙!
end意思是意外结束什么
};可能是一件备份文件损坏了,我建议楼主不要老是用一键备份/还原来备份/恢复系统,这个老会出问题的
用ghost来手动备份,一般dos工具箱里都有ghost你选个11.2版的那个ghost,一般现在集成的都是11.2的吧,然后那个界面1-2-2是备份C盘,1-2-3是恢复C盘,我手动备份从来没出错过
可以百度视频里搜下ghost备份/恢复系统教程,3分钟包你学会
谁做过这种.w文件的读取程序?vc++或者matlab,c
% ---------------------------------------------function [y,Fs,bits,opt_ck] = wread(file,ext)
nargchk(1,2,nargin);
if nargin<2, ext=[]; end % Default - read all samples
exts = numel(ext); % length of extent
if ~strncmpi(ext,'size',exts) && (exts > 2),
error('Index range must be specified as a scalar or 2-element vector.');
if ~ischar(ext) && exts==1,
if ext==0,
ext='size'; % synonym for size
else
ext=[1 ext]; % Prepend start sample index
[fid,msg] = open_w(file);
try
[riffck,msg] = find_cktype(fid,'RIFF');
if ~isempty(msg),
error('Not a WAVE file.');
msg = check_rifftype(fid,'WAVE');
end_of_file = 0;
opt_ck = [];
while(~end_of_file),
[ck,msg] = find_cktype(fid);
switch lower(ck.ID)
case 'end of file'
end_of_file = 1;
case 'fmt'
% found
[opt_ck,msg] = read_wefmt(fid,ck,opt_ck);
case 'data'
% found:
if ~isfield(opt_ck,'fmt'),
error('Corrupt WAV file: found audio data before format rmation.');
if strncmpi(ext,'size',exts) || ...
(~isempty(ext) && all(ext==0)),
% Caller doesn't want data - just data size:
[samples,msg] = read_wedat(ck, opt_ck.fmt, -1);
y = [samples opt_ck.fmt.nChannels];
else
% Read :
[datack,msg] = read_wedat(ck, opt_ck.fmt, ext);
y = datack.Data;
case 'fact'
% Optional found:
[opt_ck,msg] = read_factck(fid, ck, opt_ck);
case 'disp'
% Optional found:
[opt_ck,msg] = read_dispck(fid, ck, opt_ck);
case 'list'
% Optional found:
[opt_ck, msg] = read_listck(fid, ck, opt_ck);
otherwise
% Skip over data in unprocessed cks:
if rem(ck.Size,2), ck.Size=ck.Size+1; end
if(fseek(fid,ck.Size,0)==-1),
error('Incorrect ck size rmation in WAV file.');
catch
fclose(fid);
error(lasterr);
fclose(fid);
% Parse structure for return to user:
Fs = opt_ck.fmt.nSamplesPerSec;
if opt_ck.fmt.wFormatTag == 1 || opt_ck.fmt.wFormatTag == 3,
% Type 3 floating point has no nBitsPerSample field, so use
% nBlockAlign to figure out number of bits
bits = (opt_ck.fmt.nBlockAlign / opt_ck.fmt.nChannels) 8;
else
bits = []; % Unknown
% ------------------------------------------------------------------------
% Local functions:
% ------------------------------------------------------------------------
% OPEN_WAV: Open a WAV file for reading
function [fid,msg] = open_w(file)
% Append .w extension if it's missing:
[pat,nam,ext] = fileparts(file);
if isempty(ext),
file = [file '.w'];
[fid,msg] = fopen(file,'rb','l'); % Little-endian
if fid == -1,
msg = 'Cannot open file.';
% READ_CKINFO: Reads next RIFF ck, but not the ck data.
% If optional s is set to nonzero, reads SUBck instead.
% Expects an open FID pointing to first byte of ck header.
% Returns a new ck structure.
function [ck,msg] = read_ck(fid)
msg = '';
ck.fid = fid;
ck.Data = [];
err_msg = 'Truncated ck header found - sibly not a WAV file.';
[s,cnt] = fread(fid,4,'char');
% Do not error-out if a few (<4) trailing chars are in file
% Just return quickly:
if (cnt~=4),
if feof(fid),
% End of the file (not an error)
ck.ID = 'end of file'; % unambiguous ck ID (>4 chars)
ck.Size = 0;
else
ck.ID = deblank(char(s'));
% Read ck size (skip if subck):
[sz,cnt] = fread(fid,1,'uint32');
if cnt~=1,
ck.Size = sz;
% FIND_CKTYPE: Finds a ck with appropriate type.
% Searches from current file ition specified by fid.
% Lees file itions to data of desired ck.
% If optional s is set to nonzero, finds a SUBck instead.
function [ck,msg] = find_cktype(fid,ftype)
msg = '';
if nargin<2, ftype = ''; end
[ck,msg] = read_ck(fid);
if ~isempty(msg), return; end
% Was a required ck type specified?
if ~isempty(ftype) & ~strcmpi(ck.ID,ftype),
msg = ['<' ftype '-ck> did not appear as expected'];
% CHECK_RIFFTYPE: Finds the RIFF data type.
% Searches from current file ition specified by fid.
% Lees file itions to data of desired ck.
function msg = check_rifftype(fid,ftype)
msg = '';
[rifftype,cnt] = fread(fid,4,'char');
rifftype = char(rifftype)';
if cnt~=4,
msg = 'Not a WAVE file.';
elseif ~strcmpi(rifftype,ftype),
msg = ['File does not contain required ''' ftype ''' data ck.'];
% READ_LISTCK: Read the FLIST ck:
function [opt_ck,msg] = read_listck(fid,ck, orig_opt_ck)
opt_ck = orig_opt_ck;
orig_ = fl(fid);
nbytes = 4; % # of required bytes in header
msg = '';
err_msg = 'Error reading ck.';
if total_bytes < nbytes,
% Read standard data:
listdata = char(fread(fid,total_bytes,'uchar')');
listtype = lower(listdata(1:4)); % Get LIST type
if strcmp(listtype,''),
% Information:
while(~isempty(listdata)),
id = listdata(1:4);
switch lower(id)
case 'iart'
name = 'Artist';
case 'icmt'
name = 'Comments';
case 'icrd'
name = 'Creation date';
case 'icop'
name = ['Copy' 'right'];
name = 'Engineer';
case 'inam'
name = 'Name';
case 'iprd'
name = 'Product';
case 'ij'
name = 'Subject';
case 'isft'
name = 'Software';
case 'isrc'
name = 'Source';
otherwise
name = id;
if ~isfield(opt_ck,''),
opt_ck. = [];
len = listdata(5:8) 2.^[0 8 16 24]';
txt = listdata(9:9+len-1);
% Fix up text: deblank, and replace CR/LR with LF
txt = deblank(txt);
idx=findstr(txt,char([13 10]));
txt(idx) = '';
% Store - don't include the "name"
opt_ck..(lower(id)) = txt;
if rem(len,2), len=len+1; end
listdata = listdata(9+len:end);
else
if ~isfield(opt_ck,'list'),
opt_ck.list = [];
opt_ck.list.(listtype) = listdata;
% Skip over any unprocessed data:
rbytes = total_bytes - (fl(fid) - orig_);
if (fseek(fid,rbytes,'cof')==-1),
% READ_DISPCK: Read the DISP ck:
function [opt_ck, msg] = read_dispck(fid,ck,orig_opt_ck)
opt_ck = orig_opt_ck;
orig_ = fl(fid);
nbytes = 4; % # of required bytes in header
msg = '';
err_msg = 'Error reading ck.';
if total_bytes < nbytes,
% Read standard data:
data = fread(fid,total_bytes,'uchar');
% Process data:
% First few entries are size :
icon_data = data;
siz_ = reshape(icon_data(1:24),4,2)';
siz_ = siz_(2.^[0 8 16 24]');
is_icon = isequal(siz_,[8;40]);
if ~is_icon,
% Not the icon:
opt_ck.disp.name = 'DisplayName';
txt = deblank(char(data(5:end)'));
opt_ck.disp.text = txt;
% Skip over any unprocessed data:
rbytes = total_bytes - (fl(fid) - orig_);
if(fseek(fid,rbytes,'cof')==-1),
% READ_FACTCK: Read the FACT ck:
function [opt_ck,msg] = read_factck(fid,ck,orig_opt_ck)
opt_ck = orig_opt_ck;
orig_ = fl(fid);
nbytes = 4; % # of required bytes in header
msg = '';
err_msg = 'Error reading ck.';
if total_bytes < nbytes,
% Read standard data:
opt_ck.fact = char(fread(fid,total_bytes,'uchar')');
% Skip over any unprocessed data:
rbytes = total_bytes - (fl(fid) - orig_);
if(fseek(fid,rbytes,'cof')==-1),
% READ_WAVEFMT: Read WAVE format ck.
% Assumes fid points to the subck.
% Requires ck structure to be passed, indicating
% the length of the ck in case we don't recognize
% the format tag.
function [opt_ck,msg] = read_wefmt(fid,ck,orig_opt_ck)
opt_ck = orig_opt_ck;
orig_ = fl(fid);
nbytes = 14; % # of required bytes in header
msg = '';
err_msg = 'Error reading ck.';
if total_bytes < nbytes,
% Read standard data:
opt_ck.fmt.wFormatTag = fread(fid,1,'uint16'); % Data encoding format
opt_ck.fmt.nChannels = fread(fid,1,'uint16'); % Number of channels
opt_ck.fmt.nSamplesPerSec = fread(fid,1,'uint32'); % Samples per second
opt_ck.fmt.nAvgBytesPerSec = fread(fid,1,'uint32'); % Avg transfer rate
opt_ck.fmt.nBlockAlign = fread(fid,1,'uint16'); % Block alignment
switch opt_ck.fmt.wFormatTag
case 1
% PCM Format:
[opt_ck.fmt, msg] = read_fmt_pcm(fid, ck, opt_ck.fmt);
% Skip over any unprocessed fmt-specific data:
rbytes = total_bytes - (fl(fid) - orig_);
if(fseek(fid,rbytes,'cof')==-1),
% READ_FMT_PCM: Read
function [fmt,msg] = read_fmt_pcm(fid, ck, fmt)
% There had better be a bits/sample field:
nbytes = 14; % # of bytes already read in header
msg = '';
err_msg = 'Error reading PCM ck.';
if (total_bytes < nbytes+2),
[bits,cnt] = fread(fid,1,'uint16');
if (cnt~=1),
fmt.nBitsPerSample=bits;
% Are there any additional fields present?
if (total_bytes > nbytes),
% See if the "cbSize" field is present. If so, grab the data:
if (total_bytes >= nbytes+2),
% we he the cbSize uint16 in the file:
[cbSize,cnt]=fread(fid,1,'uint16');
if (cnt~=1),
fmt.cbSize = cbSize;
% Simply skip any remaining stuff - we don't know what it is:
rbytes = total_bytes - nbytes;
if (fseek(fid,rbytes,'cof') == -1);
% READ_WAVEDAT: Read WAVE data ck
% Assumes fid points to the we-data ck
% Requires and structures to be passed.
% Requires extraction range to be specified.
% ext should be a 2-element vector specifying the first
% and last samples (per channel) to be extracted.
% Setting ext=-1 returns the number of samples per channel,
function [dat,msg] = read_wedat(datack,wefmt,ext)
% In case of unsupported data compression format:
dat = [];
fmt_msg = '';
switch wefmt.wFormatTag
case 1
% PCM Format:
[dat,msg] = read_dat_pcm(datack,wefmt,ext);
case 2
fmt_msg = 'Microsoft ADPCM';listdata = listdata(5:end); % Move past INFO
case 3
% normalized floating-point
[dat,msg] = read_dat_pcm(datack,wefmt,ext);
case 6
fmt_msg = 'CCITT a-law';
case 7
fmt_msg = 'CCITT mu-law';
fmt_msg = 'IMA ADPCM';
case 34
fmt_msg = 'DSP Group TrueSpeech TM';
case 49
fmt_msg = 'GSM 6.10';
case 50
fmt_msg = 'MSN Audio';
case 257
fmt_msg = 'IBM Mu-law';
case 258
fmt_msg = 'IBM A-law';
case 259
otherwise
fmt_msg = ['Format #' num2str(wefmt.wFormatTag)];
if ~isempty(fmt_msg),
msg = ['Data compression format (' fmt_msg ') is not supported.'];
% READ_DAT_PCM: Read PCM format data from ck.
% Assumes fid points to the we-data ck
% Requires and structures to be passed.
% Requires extraction range to be specified.
% ext should be a 2-element vector specifying the first
% and last samples (per channel) to be extracted.
% Setting ext=-1 returns the number of samples per channel,
function [dat,msg] = read_dat_pcm(datack,wefmt,ext)
dat = [];
msg = '';
% Determine # bytes/sample - format requires rounding
% to next integer number of bytes:
BytesPerSample = ceil(wefmt.nBlockAlign / wefmt.nChannels);
if (BytesPerSample == 1),
dtype='uchar'; % unsigned 8-bit
elseif (BytesPerSample == 2),
dtype='int16'; % signed 16-bit
elseif (BytesPerSample == 3)
dtype='bit24'; % signed 24-bit
elseif (BytesPerSample == 4),
% 32-bit 16.8 float (type 1 - 32-bit)
% 32-bit normalized floating point
dtype = 'float';
% 32-bit 24.0 float (type 1 - 24-bit)
if wefmt.wFormatTag ~= 3 && wefmt.nBitsPerSample == 24,
BytesPerSample = 3;
else
msg = 'Cannot read PCM file formats with more than 32 bits per sample.';
total_bytes = datack.Size; % # bytes in this ck
total_samples = total_bytes / BytesPerSample;
SamplesPerChannel = total_samples / wefmt.nChannels;
if ~isempty(ext) && isscalar(ext) && ext==-1
% Just return the samples per channel, and fseek past data:
dat = SamplesPerChannel;
% Add in a pad-byte, if required:
total_bytes = total_bytes + rem(datack.Size,2);
if(fseek(datack.fid,total_bytes,'cof')==-1),
msg = 'Error reading PCM file format.';
% Determine sample range to read:
if isempty(ext),
ext = [1 SamplesPerChannel]; % Return all samples
else
if numel(ext)~=2,
msg = 'Sample limit vector must he 2 elements.';
if ext(1)<1 || ext(2)>SamplesPerChannel,
msg = 'Sample limits out of range.';
if ext(1)>ext(2),
msg = 'Sample limits must be given in ascending order.';
bytes_remaining = total_bytes; % Preset byte counter
% Skip over leading samples:
if ext(1)>1,
% Skip over leading samples, if specified:
skipcnt = BytesPerSample (ext(1)-1) wefmt.nChannels;
if(fseek(datack.fid, skipcnt,'cof') == -1),
msg = 'Error reading PCM file format.';
%% Update count of bytes remaining:
bytes_remaining = bytes_remaining - skipcnt;
% Read desired data:
nSPCext = ext(2)-ext(1)+1; % # samples per channel in extraction range
dat = datack; % Copy input structure to output
% extSamples = wefmt.nChannelsnSPCext;
%% Update count of bytes remaining:
skipcnt = BytesPerSamplenSPCextwefmt.nChannels;
bytes_remaining = bytes_remaining - skipcnt;
% if cnt~=extSamples, dat='Error reading file.'; return; end
% Skip over trailing samples:
if(fseek(datack.fid, BytesPerSample ...
(SamplesPerChannel-ext(2))wefmt.nChannels, 'cof')==-1),
msg = 'Error reading PCM file format.';
% Update count of bytes remaining:
skipcnt = BytesPerSample(SamplesPerChannel-ext(2))wefmt.nChannels;
bytes_remaining = bytes_remaining - skipcnt;
% Determine if a pad-byte is appended to data ck,
% skipping over it if present:
if rem(datack.Size,2),
fseek(datack.fid, 1, 'cof');
% Rearrange data into a matrix with one channel per column:
dat.Data = dat.Data';
% Normalize data range: min will hit -1, max will not quite hit +1.
if BytesPerSample==1,
dat.Data = (dat.Data-128)/128; % [-1,1)
elseif BytesPerSample==2,
dat.Data = ; % [-1,1)
elseif BytesPerSample==3,
dat.Data = dat.Data/(2^23); % [-1,1)
elseif BytesPerSample==4,
if wefmt.wFormatTag ~= 3, % Type 3 32-bit is already normalized
dat.Data = ; % [-1,1)
% end of wread.m