No one has voted on any posts yet. Votes from other community members are used to determine a member's reputation amongst their peers.
Student
- Interests
- Soccer
- PC Specs
- Pretty good.
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 |
|
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 |
|
Hi all: I got some questions on the following terminologies: Stackframe and heap. Can anybody give me some explainations with simple examples? Thanks |
|
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" … |
|
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 … |
|
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 … |
|
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 … |
|
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 |
|
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 … |
|
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() … |
|
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 … |
|
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 … |
|
: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 |
|
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 … |
|
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 … |
|
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 … |
|
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 … |
|
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); … |
|
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, … |
|
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) … |
|
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 … |
|
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 … |
|
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 … |