Posts
 
Reputation
Joined
Last Seen
0 Reputation Points
Unknown Quality Score

No one has voted on any posts yet. Votes from other community members are used to determine a member's reputation amongst their peers.

0 Endorsements
~4K People Reached
About Me

Student

Interests
Soccer
PC Specs
Pretty good.
Favorite Forums
Favorite Tags
c x 37
c++ x 6

24 Posted Topics

Member Avatar for yuzhang

Hello All: I have been thinking to learn develop a GUI using C++. Any suggestions on where to start? (Using which development kits and etc) Thank you

Member Avatar for maddog39
0
86
Member Avatar for yuzhang

Hi all: In C++, what are the common usages of a copy constructor? I know construtor can be used to initilize the object, but have not heard anything about how to use a copy construtor. Thanks

Member Avatar for Narue
0
122
Member Avatar for yuzhang

Hi all: I got some questions on the following terminologies: Stackframe and heap. Can anybody give me some explainations with simple examples? Thanks

Member Avatar for LieAfterLie
0
112
Member Avatar for yuzhang

Hi people: Here is a very basic question, but it has been bugging the living hell out of me. I am using Visual Studio 2005 and progamming in C. The whole program's skeleton was given to me, and NOT to be altered. There are several header files in the "header" …

Member Avatar for LieAfterLie
0
105
Member Avatar for playkid

[quote=playkid]ive been hearing this word but what is malloc?[/quote] Hi there: malloc is for "memory allocation". While programming, we very often need to allocate free memory for variables of unknown length, which can not be decided at the time of programming. E.g. a program prompts people's names; since each person's …

Member Avatar for yuzhang
0
236
Member Avatar for yuzhang

Hi people: Here is my problem: Codes: (My program is in the exact order as being represented here) [CODE] void push1(CStack stk) { stk.push(1); } int main(void) { CStack mystack; printf("Stack initially: "); mystack.print(); push1(mystack); } [/CODE] As you may read from above, the push1() function does not work at …

Member Avatar for yuzhang
0
122
Member Avatar for yuzhang

Hello: Now I am very close to the end of my work, thank you all for helping me out.:cheesy: There is one last strong hold: I need to somehow extract the defining parameters from their associated strings. Below is an example: Strings received from the server: BROADCAST "user_nickname" "blah blah …

Member Avatar for Dave Sinkula
0
97
Member Avatar for yuzhang

Here is the problem: Since there was a change in the code skeleton I was given, I had to somewhat modify my already-written codes to suit that minor change. Vast majority of the codes were still the same, so created a file with the same name and copy-paste the codes …

Member Avatar for Ancient Dragon
0
167
Member Avatar for yuzhang

Hi all: The function malloc returns a void* pointer, and so I need to explicitly use type cast e.g.: (struct*)malloc(sizeof(Message_from_server)); I am wondering if it is a legal expression or at least, I should give it a tag name like (struct*message_from_server)malloc(sizeof(Message_from_server)); Thanks

Member Avatar for Ancient Dragon
0
100
Member Avatar for yuzhang

Hi all: There are two function declarations in the header file: void sqEnqueue(const char *s); char *sqDequeue(); (no input arguments) Those function declarations can NOT be altered. I created a linked list in this sqEnqueue function, which has the a "first" and a "last" at the head and the end …

Member Avatar for Ancient Dragon
0
159
Member Avatar for yuzhang

Hi all: I am stuck in the middle of my programme, wishing you may help. I am writing a "quene" structure in C, and it will copy the content of a string received from a server and display it on the client monitor. Codes: [code]typedef struct Message_from_server message_from_server void sqInitialise() …

Member Avatar for Dave Sinkula
0
135
Member Avatar for yuzhang

Codes: #define MAX_BUFFER_SIZE 1000 int ch = 0, alpha [25] = {0}, buffer[MAX_BUFFER_SIZE] = {0} ,count = 0; .... while ((ch = (fgetc(stream)))!=EOF) { buffer [count] = ch; count++; } printf("%d", alpha [25]); ..... The problem is: alpha [25] contains buffer [0], (alpha[25] is supposed to be 0). which suggests …

Member Avatar for ivanCeras
0
98
Member Avatar for yuzhang

Hi all: Got a formatting question here: Trying to send data string over to a server via send(); The problem is that I want to enclose the data string with double-quotes, "data string" should be displayed on the server side. The method I used is using two double_quotes on each …

Member Avatar for yuzhang
0
274
Member Avatar for yuzhang

:sad: Codes: if (sock!=INVALID_SOCKET) { if(send(sock,s,(int)strlen(s),0)==SOCKET_ERROR) { WSAGetLastError(); } } s is a char pointer pointing to the very first memory location of the data string. While in debugging mode, there was no error from `WSAGetLastError()`, but the data string was not displayed in the server. Why? Thanks

Member Avatar for yuzhang
0
147
Member Avatar for yuzhang

Hi all: Just want to confirm the process that I employed to use this "critical section" feature of Microsoft Visual Studio is correct. Say, there are two processes that I want to protect. Codes: while(1st process is active) { InitializeCriticalSection(&cs); EnterCriticalSection(&cs); Do something; LeaveCriticalSection(&cs); [B]DeleteCriticalSection(&cs);[/B] } while (2nd process is …

Member Avatar for SpS
0
126
Member Avatar for yuzhang

Hi all: Say, my program is about to receive a string "ABC", and I want to test if the string really contains "ABC". What is the best way to test it? I am thinking of read all the characters from the incoming string one by one, but not sure which …

Member Avatar for SpS
0
257
Member Avatar for yuzhang

Hi all: According to the library, recv() will return a zero if the socket is closed, and a SOCKET_ERROR if the socket meets an error. But when I closed my socket (at least I think I closed it properly), recv() returned a SOCKET_ERROR other than zero. Wondering why? Thank you …

Member Avatar for yuzhang
0
99
Member Avatar for yuzhang

Hi all: I have successfully opened a socket to a server and trying to send some data vai the send() function. But what surprised me is: [URL="http://www.daniweb.com/techtalkforums/wsagetlasterror_2.htm"][B]WSAGetLastError[/B][/URL]() returns nothing, which means the data has been sent to the server, however all the data (a string) will only be displayed at …

Member Avatar for yuzhang
0
168
Member Avatar for yuzhang

Hi all: I wrote a simple program to open a socket to localhost port 8201. Codes: ...... [CODE]if (WSAStartup(VERSION, &wsadata) != NO_ERROR) { WSACleanup(); return EXIT_FAILURE; } open_socket(serverName, port); SOCKET open_socket (const char *serverName, const int port) { struct hostent *server = NULL; SOCKADDR_IN serverAddress; sock = socket(AF_INET, SOCK_STREAM, 0); …

Member Avatar for yuzhang
0
215
Member Avatar for yuzhang

Hi guys: I have a very strange problem here. Under Linux Mandriva Powerpack 2006, KDE I "make" the program I wrote successfully in the terminal, without any errors. And I could see there was an executable file generated in the same folder. But when I typed in the program name, …

Member Avatar for Salem
0
81
Member Avatar for yuzhang

Hi all: Try to do some programming under Linux. The programme I am writing is supposed to read all the char from a file via "command in line argument (i.e. agv[i])" and via redirection (i.e. read <FILE_NAME. In my program, I have written: FILE *stream; stream = fopen(argv[i],"r"); if (stream==NULL) …

Member Avatar for yuzhang
0
384
Member Avatar for yuzhang

Hello all: I successfully use `(int)i=fgetc(stream)` to read data from a file. But the problem is: All the data in the file are integers, like 3 0 2 3 0 0 1. (with a space between every two integers) Code: for(i=0;(i<100)&&((n=fgetc(stream))!=EOF)&&(ch!='\n');i++) { buffer[i] = n; printf("%d=%d ",i, buffer[i]); /*For debugging …

Member Avatar for Ancient Dragon
0
147
Member Avatar for yuzhang

Consider a line of simple C code: fopen("C:\\project\\test1.dat","r"); it "directs" the program to the directory where it can find the file from which it will read. My question is under what circumstances, I may write fopen("test1.dat","r") instead? Does the program need to be in the same folder / directory as …

Member Avatar for yuzhang
0
291
Member Avatar for yuzhang

A newbie here. I try to: Using MS Visual Studio 2005; Programming some simple C programs; Want to open a text file and read whatever it the file into a member of a struct. First of all, which type is this "FILE" anyway? Secondly, does the definition of "stdin" include …

Member Avatar for yuzhang
0
183

The End.