这是我的代码
#include "stdafx.h"**
class IPlayback
{
public:
virtual void createRenderStream() = 0;
};
class ICapture
{
public:
virtual void createCaptureStream() = 0;
};
class IAudioStackInterface
{
public:
virtual void createStream() = 0;
};
class CAudioClientInterface : public IAudioStackInterface,
public ICapture,
public IPlayback
{
void createCaptureStream()
{
printf("\n i am in createCaptureStream");
}
void createRenderStream()
{
printf("\n i am in createRenderStream");
}
void createStream()
{
printf("\n i am in createStream");
}
};
typedef IAudioStackInterface* PIAudioStackInterface;
typedef ICapture* PCapture;
typedef IPlayback* PIPlayback; …Run Code Online (Sandbox Code Playgroud) 当我尝试从文件中读取整数时,代码最终会读取与预期不同的数字.
数据文件包含以下数字:
1111 111 222 333 444 555 666 777 888 -1
Run Code Online (Sandbox Code Playgroud)
当我读取文件时,它返回以下数字:
825307441 825307424 842150432 858993440 875836448
892679456 909522464 926365472 943208480 170994976
Run Code Online (Sandbox Code Playgroud)
为什么会这样?
相关代码:
/* A file named data contains some integer numbers.write a program to
read these numbers and store the odd numbers in one file and store
the even numbers in file.*/
int main()
{
FILE *fp1,*fp2,*fp3;
int number;
fp1=fopen("DATA","r");
fp2=fopen("even","w");
fp3=fopen("odd","w");
printf("numbers in file are\n");
while((number=getw(fp1))!=EOF)
{
printf("%d\t",number);
}
fclose(fp1);
fp1=fopen("DATA","r");
while((number=getw(fp1))!=EOF)
{
if((number%2)==0)
{
putw(number,fp2); …Run Code Online (Sandbox Code Playgroud) 我对perl非常新,当我尝试分配一个标量值并且我正面临问题的打印时才开始学习.我在做
perl -e "$number=30;"
perl -e "print $number;"
Run Code Online (Sandbox Code Playgroud)
除非我这样做,否则输出不显示任何内容
perl -e "$number=30; print $number;"
Run Code Online (Sandbox Code Playgroud)
输出显示30为什么?
我知道C程序通常以return结束,我们返回程序的状态.但是,我想返回一个字符串.
我将从Python脚本调用C-executable并打印返回的字符串.由于main无法返回字符串,我该怎么做?