|
I have solved the 1010 compiler error unexpected EOF by deleting dependencies with *.pch files.Now I have linker error LNK2001 unresolved external symbol _winmain@16.Please help.This is my code:
int APIENTRY WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmd,int nCmdShow )
{
int brojevi[9];
brojevi[0]=3;
int s;
s=1;
brojevi[s] = brojevi[0];
while(s<9)
{
brojevi[s]=brojevi[s]*3+8;
s++;
}
s=0;
while(s<9)
printf("\nbrojevi[%d] = %d",s,brojevi[s]);
return 0
};)
|
|
|
|
|
This looks like it might be a Unicode problem. Change your entry point (Project --> Settings --> Link --> Output) to wWinMainCRTStartup and see if that solves the problem. See MSDN article Q125750 for more.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Hi I have an assignment to hand in shortly for which I am after some guidance. The task is to read a WAV file, request a fade in /out time for the track from the user and the do the fade by modifying the binary file then writing it as a new file I have attached my code so far but do not know how to do the fade and how to write it as a new file. Please help!
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
void main ()
{
FILE *oldwav,*newwav;
char *stgfilename;
char riff[5];
char wave[5];
char fmt[5];
char data[5];
unsigned long int length, binary, stereo, mono, bits, sample, bps, bpsam, bitsps, sound, ldata;
int s, m, time, count;
float fadein, track, track1, fadeout;
/* */
stgfilename=(char*)malloc(81);
printf("Please enter the file path of your wav file\n\r");
gets(stgfilename);
oldwav=fopen(stgfilename,"rb+");
if(oldwav==NULL)
{
printf("Cannot find the file specified\n\r");
exit(1);
}
/* To start the RIFF Chunk must be determined*/
fread(riff,1,4,oldwav);
riff[4]='\0';
printf("header contains %s this is a wav file!!\n\r", riff);
if (strcmp(riff,"RIFF")!=0)
{
printf("error in header not wav file\n\r");
fclose(oldwav);
exit(1);
}
fread(&length,4,1,oldwav);
printf("The length of the wav file is %lx hex\n\r", length);
printf("The length of the wav file is %ld decimal\n\r", length);
fread(wave,1,4,oldwav);
wave[5]='\0';
printf("the format header contains %s\n\r", wave);
if (strcmp(wave,"WAVE")!=0)
{
printf("error not in WAV format\n\r");
fclose(oldwav);
exit(1);
}
/* Secondly the FORMAT Chunk must be determined*/
fread(fmt,1,4,oldwav);
fmt[3]='\0';
fmt[4]='\0';
printf("the format header contains %s\n\r", fmt);
if (strcmp(fmt,"fmt")!=0)
{
printf("error\n\r");
fclose(oldwav);
exit(1);
}
fread(&binary,4,1,oldwav);
if (binary!=0X10)
{
printf("error\n\r");
fclose(oldwav);
exit(1);
}
printf("header file contains %lx\n\r",binary);
fread(&bits,2,1,oldwav);
if (bits!=0X01)
{
printf("error corrupted file this should be 01 always!\n\r");
fclose(oldwav);
exit(1);
}
printf("Check bytes 8-9 are 01 ---> Correct 01\n\r");
fread (&stereo,2,1,oldwav);
if (stereo!=0X02)
{
printf("the file is not stereo\n\r");
}
if (stereo==0x02)
{
printf("the file is stereo\n\r");
s=2;
}
if (stereo!=0X01)
{
printf("the file is not mono\n\r");
}
if (stereo==0x01)
{
printf("the file is mono\n\r");
m=1;
}
fread(&sample,4,1,oldwav);
printf("The sample rate of the wav file is %lx hex\n\r", sample);
printf("The sample rate of the wav file is %ld decimal\n\r", sample);
fread(&bps,4,1,oldwav);
printf("The bytes per second of the wav file is %lx hex\n\r", bps);
printf("The bytes per second of the wav file is %ld decimal\n\r", bps);
fread(&bpsam,2,1,oldwav);
printf("The bytes per sample of the wav file is %lx hex\n\r", bpsam);
printf("The bytes per sample of the wav file is %ld decimal\n\r", bpsam);
if (bpsam==0x01)
{
printf("this is 8 bit mono!!\n\r");
s=1;
}
if (bpsam==0X02)
{
printf("this is 8 bit stereo or 16 bit mono!!\n\r");
s=2;
}
if (bpsam==0X04)
{
printf("this is 16 bit stereo!!\n\r");
s=4;
}
printf("the value of s is ---> %d this a multiplier for?\n\r",s);
fread(&bitsps,2,1,oldwav);
printf("the bits per sample of this wav file is %lx hex\n\r", bitsps);
printf("the bits per sample of this wav file is %ld decimal\n\r", bitsps);
/* Thirdly the DATA Chunk must be determined*/
fread(data,1,4,oldwav);
data[4]='\0';
if (strcmp(data,"data")!=0)
{
printf("error\n\r");
fclose(oldwav);
exit(1);
}
printf("third line contains %s !!\n\r", data);
fread(&sound,4,1,oldwav);
printf("length of data to follow %lx hex\n\r", sound);
printf("length of data to follow %ld decimal\n\r", sound);
/* Convert the length of the file into seconds */
time=sound/(s*sample);
printf("time of track = %d seconds\n\r",time);
/* Providing the fadein time the user requires*/
printf("INPUT TIME FOR FADEIN FROM START...\n\r");
scanf("%f",&fadein);
printf("The fade in time is %f seconds\n\n\r",fadein);
track=(fadein*bps);
printf("the fadein in bytes = %f\n\r",track);
/* Check the fadein time to make sure it is not less than or equal to zero*/
if (fadein<=0)
{
printf("error time can't be less than or equal to zero\n\r");
printf(" INPUT TIME FOR FADEIN FROM START...\n\r");
scanf("%f",&fadein);
printf("The fade in time is %f seconds\n\n\r",fadein);
track=fadein*bps;
printf("the fadein in bytes = %f\n\r",track);
}
if (fadein>=time)
{
printf("error time can't be more than or equal time of track\n\r");
printf(" INPUT TIME FOR FADEIN FROM START...\n\r");
scanf("%f",&fadein);
printf("The fade in time is %f seconds\n\n\r",fadein);
track=fadein*bps;
printf("the fadein in bytes = %f\n\r",track);
}
/* Providing the fadeout time the user requires*/
printf("INPUT TIME FOR FADEOUT TO START...\n\r");
scanf("%f",&fadeout);
printf("The fade out time is %f seconds\n\n\r",fadeout);
track1=fadeout*bps;
printf("the fadeout in bytes = %f\n\r",track1);
/* Check the fadeout time to make sure it is not less than or equal to zero*/
if (fadeout>=time)
{
printf("error time can't be more than or equal to the length of the track\n\r");
printf(" INPUT TIME FOR FADEOUT TO START...\n\r");
scanf("%f",&fadeout);
printf("The fade out time is %f seconds\n\n\r",fadeout);
track1=fadeout*bps;
printf("the fadeout in bytes = %f\n\r",track1);
}
if (fadeout<=fadein)
{
printf("THIS IS IMPOSSIBLE PLEASE CHECK YOUR FADE OUT TIME\n\r");
printf(" INPUT TIME FOR FADEOUT TO START...\n\r");
scanf("%f",&fadeout);
printf("The fade out time is %f seconds\n\n\r",fadeout);
track1=fadeout*bps;
printf("the fadeout in bytes = %f\n\r",track1);
}
/* Fade in Calculation*/
}
|
|
|
|
|
Hi All,
Can anybody suggest me "Verfication tool for c++ code" which can do following things:
1) Check whether the code is following the coding guidelines.
2) Check if there is any memory leakage
3) suggest how to improve the code in terms of performance??
I am really find it tough to search such a kind of tool. If you know something also, please suggest me.
regards,
Arpitha
|
|
|
|
|
|
Dear Alok,
Thanks a lot for replying.
This link,
http://www.codeproject.com/showcase/memoryvalidator.asp[^], gives the memory status and leakage if any.
But I wanted something which checks whether the code is following the "Coding guidelines". Can you please suggest some other link where I can download the tool for free?
Regards,
Arpitha
|
|
|
|
|
|
Dear Alok,
Thanks a lot for replying.
The link,
http://www.codeproject.com/showcase/memoryvalidator.asp[^] has tool for memory leakage. But I wanted some tool which verifies the code, ie whether it is according to "coding guidelines". Basically for code review kind of thing.
Can you please suggest some tool which I can download freely from net??
Please reply,
Regards,
Arpitha
|
|
|
|
|
Hope is your problem solved or still something left!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
I want to pass content of textbox created in web application(vb.net) to the textbox of the windows application. Please send the details as early as possible. Looking for your kind reply.
Shrinidhi
|
|
|
|
|
Hi I’m going to store a zipfile in a SQL database.
From my MFC-app I like to read the “binary contents” of a zipfile into a CString. The string is going to be added into the DB via a Web service call.
How can I Read a .zip-file to a CString and then back to a .zip-file?
_____________________________
...and justice for all
APe
|
|
|
|
|
Storing binary data in CString is not the way to go ahead... Strings are NULL terminated as you probably know, so Believe me if you look at the binary data as characters, you will encounter a NULL character before you reach the end of the file...
|
|
|
|
|
... yeah, of course. Hmmmmp...
I'm going to call a web service that later will store the zip-filein a SQL DB.
Have to think about this...
_____________________________
...and justice for all
APe
|
|
|
|
|
Click on the link below to 'My Articles' and look at my 'bugreporter' project. I've got code in there that saves files to the database and also extracts and recreates them on the fly.
My articles
www.stillwaterexpress.com
BlackDice
|
|
|
|
|
Thanks! I'm having a look at it.
_____________________________
...and justice for all
APe
|
|
|
|
|
hi, i'm trying to package my console program as a static standalone, i.e. make it such that it does not require any dlls/libs on the client machine.
can someone tell me how to do it?? thanks a lot!
|
|
|
|
|
MFC as a statically linked library rather than DLL and make sure you don't specifiy an external DLLs.
Elaine
The tigress is here
|
|
|
|
|
hi, thanks for replying.
what do u mean by don't specify an external dll? i'm using oracle and so, i do have to use a certain oracl32.lib
would that be what u mean?
|
|
|
|
|
Then I think this won't be possible then. Unless you have lib file provided so you can statically link it instead of dynamically...
|
|
|
|
|
yes, i do have the lib file. u mean *.lib right? i have that. so how can i statically link it?
|
|
|
|
|
Normally (but I'm not sure), you can go to the project settings somewhere and specify all the libraries you are using. But I don't remember exactly where and I don't have VC++ installed here...
|
|
|
|
|
i've already done the settings. the problem arises when i try to use another computer that doesn't have the libraries already installed.
when i do so, the program won't work and it will complain that the libraries are not available. the problem is i can only have one file to push, as i'm doing a activex object. so i need to package those additional dlls/libs into the dll that i'm creating.
please help, i'm tearing my hair out!
|
|
|
|
|
ng kok chuan wrote:
the problem is i can only have one file to push, as i'm doing a activex object. so i need to package those additional dlls/libs into the dll that i'm creating.
?? Uhh... Why ?? An active X can use external dll, what is the problem here ?? You just need to ship all the files
|
|
|
|
|
it's cos the other files can't be installed as dlls. i'm using dlls from oracle and visual studio c++, and in order to use those dlls, it requires oracle and vc++ to be installed. i've tried registering the files manually but it doesn't work. hence the requirement to package as a static file instead of using dlls.
sigh, weird solution to a weird problem...
|
|
|
|
|
there is a way of creating ur own user defined messages .....can some one give me any linkz regarding that?.....
cheerz.....
"faith, hope, love remain, these three.....; but the greatest of these is love" -1 Corinthians 13:13
|
|
|
|
|