1,494 Posted Topics
Re: Maybe you can start by giving us the basics...Does it compile error/waring free? If not which errors and warnings are generated? Is it a run time problem? If so what's the problem? We need more than 'is not running anymore'. | |
Re: After I include cstdio the program compiled and ran as expected..Actaully line 33 in your program might be incorrect. Your passing the address of dwArg to create thread which is changing as the loop iterates, this is probably what's causing the weird nummbers. | |
Re: Check this out [code] Broken-down time is stored in the structure tm which is defined in <time.h> as follows: struct tm { int tm_sec; /* seconds */ int tm_min; /* minutes */ int tm_hour; /* hours */ int tm_mday; /* day of the month */ int tm_mon; /* month */ … | |
Re: Your going about this the wrong way. Customers member function 'showCustomers' shouldn't loop through the Customers objects, it should only display its values. You should have a loop like [code] for (int i = 0; i < 150; ++i) { CustArray[i].showCustomers(); } [/code] | |
Re: Your Hi variable [code] char Hi[4] = {'3','E','2','C'}; [/code] is four bytes with the values of(in ascii) 0x33 = '3' 0x45 = 'E' 0x32 = '2' 0x43 = 'C' and this (in ascii) [code] Bye[0] = 0x3E and Bye[1] = 0x2C [/code] would equate to [code] Bye[0] = '>' and … | |
Re: You should get into the habit of initializing data member like so [code] Vector::Vector () :x = 0,y = 0,z = 0 {} Vector::Vector (float a, float b, float c) :x = a,y = b,z = c {} [/code] In some situations its more efficient. | |
| |
Re: If your going to increment your pointer then save its original value somewhere and delete that. | |
Re: Try working with setprecision like below [code] #include<iostream> #include <iomanip> int main() { double my_f = 1.0/3.0 / 30.0; std::cout << my_f << std::endl; std::cout << std::setprecision (100) << my_f << std::endl; } [/code] | |
Re: Line 19...Why are you closing write here? actually line 16...Why are you opening write here? Try looking at the code below [code] #include <stdio.h> #include <stdlib.h> #define BSIZE 24 int main() { char ch[BSIZE]; FILE *fout; FILE *fin; if (!(fin = fopen("testfile", "r"))) { fputs("could not open testfile!\n", stderr); exit(EXIT_FAILURE); … | |
Re: Try working with the modulus operator...Like below [code] #include <stdio.h> int main(int argc, char**argv) { fprintf(stdout, "%d\n", 12345 % 10); fprintf(stdout, "%d\n", 12345 % 100); fprintf(stdout, "%d\n", 12345 % 1000); return 0; } [/code] This should give you a good start... | |
Re: Your created an array of structures struct secguard guard_rec[300]; So to access one element of your array you must use an array index like gets(guard_rec[0].first_name); Oh by the way the use of gets is really frowned upon...really. Here's why BUGS Never use gets(). Because it is impossible to tell without … | |
Re: Instead of having a function that removes duplicates, why not design the linked list functionality so that it will not accept duplicates..e.g. inserting a new node that results in a duplicate will do nothing. | |
Re: Does your file have a main function? Plus could you post your compile line or makefile? | |
Re: First question. Are you allowed to use the Standard Template Library? | |
Re: [QUOTE=shanki himanshu;1426436]@kamatari..not yet..!!! bt i am thinking of making a game and it will surely take time. our teachers has informed us about dis project at the last moment.[/QUOTE] If the teachers dumped this project on the class 'at the last moment' then I expect the class and yourself will … | |
Re: GCC's linker supports alternate entry point names ld - The GNU linker -e entry --entry=entry Use entry as the explicit symbol for beginning execution of your program, rather than the default entry point. If there is no symbol named entry, the linker will try to parse entry as a number, … | |
Re: Which one are you talking about? I tried compiling your program and got several warnings and errors.e.g [code] gcc testc.c -Wall -ansi -pedantic -o testc.c testc.c: In function ‘main’: testc.c:12: warning: format ‘%s’ expects type ‘char *’, but argument 2 has type ‘char (*)[20]’ testc.c:13: warning: format ‘%s’ expects type … | |
Re: Try this g++ testit.cpp -E testit >testfile | |
Re: Try changing line 29 to myQ.AddMSG(myNewMessage); | |
Re: Just a point...Is it a good idea to call your thread array main[]; Also.. [code] int x[50]; int y[50]; void *run(void *i) { int trial = (int)i; int mode; int Xcor[50]; int Ycor[50]; while (trial!=10) { mode = rand() % 50; x[trial]=Xcor[mode]; y[trial]=Ycor[mode]; } pthread_exit(NULL); } [/code] Your accessing the … | |
Re: Mysql has this great site with all this info and tuorials [url]http://zetcode.com/tutorials/mysqlcapitutorial/[/url] | |
Re: Well if you needed negative values then you would use signed char. | |
Re: I would use the functions toupper or tolower to make your code portable. [code] int ans = toupper(val); if (ans == val) { /*is upper case*/ } else { /*is lower case*/ } [/code] | |
Re: I didn't read your post in its entirety but I can inform you about this...On Intel/AMD machines the smallest addressable memory is a byte. If you have to work with bits they are not directly addressable so you have to use masking operations to access them...e.g. You can't point a … | |
Re: Here's the output from my computer Parent Writing [0]... Parent Writing [1]... hello there Parent Writing [2]... Parent Writing [3]... Parent Writing [4]... Parent Writing [5]... Parent Writing [6]... Parent Writing [7]... Parent Writing [8]... Parent Writing [9]... [gerard@localhost test]$ hello there hello there hello there hello there hello there … | |
Re: Why would you want to translate something that's hard wired to a specific address? typedef void (*t_ChatPrint) ( char * ); t_ChatPrint ChatPrint = (t_ChatPrint)0x0054E410; Your function pointer ChatPrint is hard wired to 0x0054E410.. Can I ask you a question? Why are you translating code when you don't even know … | |
Hi, Is there ever a situation where the programmer needs to be concerned about the copying of a vtable pointer or can I happily assume that the C++ language will handle that detail correctly without my intervention? | |
Re: [QUOTE=neemo6;1420345]Is there a toUpper or toLower in C/++ ?[/QUOTE] The ctype.h library has functions int toupper(int c); int tolower(int c); | |
Re: "warning: incompatible implicit declaration of built-in function 'malloc'" Are you including stdlib.h? | |
Re: You could try a union with a packed structure..If you using MS you'll have to Google to find out how to pack a structure... [code] #include <stdio.h> union mu { int x; struct { unsigned int a:8; unsigned int b:24; }__attribute__((packed)) in; }; int main(void) { union mu theu; theu.x … | |
Re: I would look at two for loops [code] for (int i 0; i < x; ++i) { for (int j = 0; j < y; ++j) { } } [/code] | |
Re: An array define like so int my_array[4]; has elements 0 - 3 not 0 - 4 | |
Re: Erase will call the string's destructor hence destroying the string object. | |
Re: I'm not sure what your trying to accomplish here...Are you try to create a unique socket API for both Windows and Linux? Oh by the way, your Linux function is lacking..What does it return if its successful? | |
Re: If your using GNU's compiler then the compile should be g++ source.cpp -o executable_name The errors your receiving indicate that you have two main functions...GNU reduces the main function to _start. | |
Re: Yes that's correct if your input buffer is empty. | |
Re: This might be your problem... On line 14 your freeing Curr and then on line 16 you set Prev to Curr...Prev now equals NULL. | |
Re: Are these supposed to be floats? float Place_Of_Birth; float Email_Address; It makes more sense to have it as char Place_Of_Birth[45]; char Email_Address[45]; Your scanf is incorrect here scanf ("%c",&Name); You need to scan for a c-string scanf ("%s",Name); These lines are wrong.. scanf ("%s",&Place_Of_Birth); scanf ("%s",&Email_Address); should be scanf ("%s",Place_Of_Birth); … | |
Re: [QUOTE=lochnessmonster;1414576]so....would a program compiled on a 64bit pc not work for a 32 bit pc?[/QUOTE] That really depends since you can create 32 bit PC programs with 64 bit PC compilers. | |
Re: Here's an example to look at. A note the function modifies the original string so it my not be appropriate for your assignment. [code] #include <stdio.h> #include <stdlib.h> #include <string.h> char ca[] = "this is the string to tryout on our reverser"; void myfunc(char *s) { int i = 0; … | |
| |
Re: Yeah you might want keep input as a c-string and use strcmp for your comparisons. | |
Re: Try the code below [code] #include <stdio.h> int main() { int x = 67; fprintf(stdout, "c->%c\n", (char)x); fprintf(stdout, "c->%c\n", x); return 0; } [/code] | |
Re: Try writing your code like this...please note that I write to the file and then close and then open for input. [code] #include <iostream> #include <fstream> #include <cstdlib> using namespace std; int main() { ofstream file1("test"); int random = rand() % 100; cout << random << endl; file1.write((char *)&random, sizeof(int)); … | |
Re: I use neither! I use Gedit for C programming and Kdevelop for C++....Why? IMHO, Kdevelop is the best/simplest IDE out there. Plus I really appreciate Kdevelop's code completion algorithm. | |
Re: [QUOTE=+_+man;1348762][COLOR="Red"][U]Need Help Making Keylogger[/U][/COLOR] Hi everyone, My name is hayzam and i want to make an advanced keylogger and what to put it in a USB So when I connect my usb it will open automatically and it must be invisible one more thing i am a newbie to C++ … | |
Re: You might not like the previous posting but its accurate...Your using a pointer that's pointing to nothing.. [code] int main() { process *p;/*this points to nothing*/ p->pid = 1; p->reference_string = "000111222"; [/code] |
The End.