|
Specify the required lib file Ws2.lib
Regards,
Paresh.
|
|
|
|
|
Requirement section for this API mention Ws2_32.lib as library. You need to link that.
Prasad
MS MVP - VC++
|
|
|
|
|
|
Programm3r wrote: WIN32 Console application
You need to start with an MFC (not Win32) GUI (not console) app.
|
|
|
|
|
Well Im a student and yesterday appeared in external examination (Lab Test)for "Data Structure Using C".
I was asked to write a program to do following thing :
1.Read Unsorted data(Rno & Marks)from an existing data file.
2.Display Unsorted data.
3.Using Linked list, sort the data on the basis of Rno.
4.Display Sorted data in increasing order.
5.Display same sorted data in decreasing order.
6.Search a particular record on the basis of some key(Rno).
In response what i did was
1.Make a write() and read() function in C using fopen() and fread() and fwrite().
2.Create a singly Linked list and while reading data in read() it used to fill it in the same way as it was stored on file.
3.Display the unsorted list.
4.Use bubble sort to sort the list and display it in Increasing order.
5.Searching on the basis of Rno.
Sorry for posting such a huge amount of text but i wanna make things clear.
My teacher told me that I should have put data into linked list in ordered manner while reading from file i.e. somewhat Insertion sort. I agreed but argued on the fact that question paper didnt mention to force me to use the best technique so i was free to use any sort.
But the nutshell was that i was failed and was told to appear again for the test next year.
Can any tell whether im right or wrong so that i can go to my HOD for the same.
Spread wat u Know!
|
|
|
|
|
Serious answer: Sounds to me like you got shafted
Humorous answer: One of your superiors changed their mind about the spec, and then blamed you? Welcome to the world of software.
|
|
|
|
|
Maybe I am missing something here, but requirements had 6 steps and you only listed 5.
Did you remember to display it in descending order as well?
I would hardly argue they could fail you if yousupplied all required steps, since there are no specifications regarding performance, system limitations, or otherwise.
If I had said this would be a high load system and this would be done several times per hour, I might have had issue with the bubble sort and singly linked list.
I think you would have found you had trouble with the descending display, unless you 'unbubbled' your items to reverse their order - basically you went through your list sorting it twice, then.
|
|
|
|
|
I must say "thnx" to the writer of article "Calling Conventions Demysified".
It is such a good article, i mean im a student n i feel it is must for every c programmer.
But im confused with what was written in first few lines :
"the value is returned in EAX register."
I mean no problem with basic types but how this statement fits fine for structures like:
struct abc
{
int x;
float y;
};
struct abc fun(void)
{
struct abc x;
x.x=0;
x.y=1;
return x;
}
Spread wat u Know!
|
|
|
|
|
Returning things that don't fit into a register have a special rule in all calling conventions that use a register to return values. One possible solution some calling conventions use is that the caller reserves the memory for the return value and passes a pointer to it to the called function as a hidden parameter.
So your example would be compiled like:
struct abc
{
int x;
float y;
};
void fun(struct abc *result)
{
struct abc x;
x.x=0;
x.y=1;
*result = x;
}
An optimizing compiler might assign directly to result->x and result->y.
|
|
|
|
|
help me pls...i m using c++ to do it..
hope can help me bcos the due date is near and i still cannot find any solution on its...
i only can display bitmap but when display in other image format...it cant load and display..
|
|
|
|
|
|
i have try this b4....but the problem is "Before use the CEDraw Library, you must copy some support file in you system"
a. Copy the dll to you WinCE system directory
1.If using in emulation mode, copy two of the dll in …\CEGraph\DLL\X86Em directory ( gx.dll & cegl.dll) to the emulation windows system directory, always in the D:\Windows CE Tools\wce300\MS Pocket PC\emulation\palm300\windows directoty, then copy the file Hzk16 in the …\CEGraph\Res directory to the WinCE Root directory, always in D:\Windows CE Tools\wce300\MS Pocket PC\emulation\palm300
2.if using an Arm system, copy the two DLLs in …\CEGraph\DLL\Arm ( gx.dll & cegl.dll) to the Pocket PC windows system directory. Then copy the file HZK16 to the System Root directory.
i found that i don hav ethe gx.dll and cgl.dll in my d drive or cdrive...so how should do to solve that kind of problem??????????
|
|
|
|
|
Both files (gx.dll & cegl.dll) are in the archive of the article (here), in the CEGraph/DLL subfolder. Find them and follow the article.
-------------------------
Don't worry, be happy )
|
|
|
|
|
but why the path that provided is not same with mine1??it say copy both file into D:\Windows CE Tools\wce300\MS Pocket PC\emulation\palm300\windows directoty...but in fact,i cannot find the exact path either in c drive or d drive....mine1 is D:\Windows CE Tools\eVC4..
|
|
|
|
|
The only thing I can recommend - try. Obviously, the author of the article gave HIS paths, that can differ among users...
-------------------------
Don't worry, be happy )
|
|
|
|
|
after i finish copy the .dll file into specific directory...
i wil go to next step which set up the directory..i have found dificuties on its..
where shoud i start set the including and lib directory??
when i open the project setting, i found that there may not have --->Link--->Object ???
hope can giv me a perfect solution on its...;P
|
|
|
|
|
I used Visual Memory Leak in my code and it has reported memory leak from files having this code. Can anyone give information as to whether these codes can lead to memory leak or not
************************************
case 1
************************************
sub_code = (char *) calloc(5,sizeof(char));
if(f_decimal_value !=0 )
{
free(sub_code);
sub_code = (char *) calloc(3,sizeof(char));
//additional code here
free(sub_code);
}
else
{
free(sub_code);
sub_code = (char *) calloc(3,sizeof(char));
//additional code here
free(sub_code);
}
*********************************************
case 2
**********************************************
sub_code = (char *)calloc(3,sizeof(char));
char2str(2,sub_code)
if(strcmp(sub_code,"00") == 0)
{
free(sub_code);
//additional code here
}
else if(strcmp(sub_code,"01") == 0)
{
free(sub_code);
//additional code here
}
else if(strcmp(sub_code,"10") == 0)
{
free(sub_code);
//additional code here
}
else if (strcmp(sub_code,"11") == 0)
{
free(sub_code);
//additional code here
}
|
|
|
|
|
The bits you leave out are the bits we need to see!
For example, in the first example the code that's missing and commented with "//additional code here" could cause a leak if:
- It returns.
- It stomps on the pointer value in sub_code without seeing that it's freed.
- It throws an exception.
Steve
|
|
|
|
|
Case 2 could lead to a leak because your "else if" chain has no final else clause. If none of the conditions apply, sub_code will never be freed.
You could just add at the end
else
free(sub_code);
and that would take care of it.
|
|
|
|
|
Can anyone help me to create a tree view after parsing a file
ie from the file dialog when we open a file, it should be loaded in to a tree structure. Also i want to save the items in the tree in to a file.
syam.
|
|
|
|
|
Do you want to pasre a xml file and what does mean "create a tree view after parsing a file" ?
|
|
|
|
|
To parse the file and with the items obtained build the tree structure..........
|
|
|
|
|
Hi all, am writing a program in embedded VC++...
am new to programming so i need some help with a little thing..
i have a form that the user will input a hex value (memory address) and my program will copy this value to a pointer.. but it just isn't working. here is my code
DWORD *pDUMMY;
TCHAR sztTmp[10];
GetDlgItemText(hwndDlg, IDC_EDT_NAME,sztTmp, 10);
pDUMMY=(DWORD *)(sztTmp); //this line needs some editing
example: user enters 0x8fff42a2
should equal pDUMMY = (DWORD *) (0x8fff42a2)
sorry for the stupid question.. i'm helpless...
|
|
|
|
|
pDUMMY = _tcstoul( sztTmp, NULL, 0 );
passing the 0 means that if the string starts with 0x then it's assumed to be hex, if it starts with 0 and not an x then it's assumed to be octal, and otherwise it's assumed to be a decimal value so it's rather flexible.
you can pass 16 instead if you always assume the value is hexadecimal.
|
|
|
|
|
Rick York wrote: pDUMMY = _tcstoul( sztTmp, NULL, 0 );
actually you have to do
*pDUMMY = _tcstoul( sztTmp, NULL, 0 );
note the pointer dereference operator.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|