255 Posted Topics

Member Avatar for sat4ever0606

Lets just take a look at this code: [CODE=C]ptr=n*(malloc(sizeof(n)); ptr=head; scanf("%d",&ptr->data); head=ptr->data; ptr=ptr->next; [/CODE] You don't need line 1 because you just set it to point to a space of memory that has already been allocated ([ICODE]head=n*(malloc(sizeof(n));[/ICODE]). Lines 2 and 3 look alright to me. Line 4 doesn't work (I …

Member Avatar for death_oclock
0
148
Member Avatar for Dewey1040

Purely for the sake of simplicity, I would go with this route (doesn't use a second set of variables): [CODE=C] int main( int argc, char *argv[] ){ int *numberlist, i, n, min, max ; n = atoi( argv[1] ); numberlist = ( int * ) malloc( n * sizeof( int …

Member Avatar for Dewey1040
0
201
Member Avatar for death_oclock

I have designed my page using Firefox and it looks exactly as I would expect it to, colors consistent with my design using Photoshop. When I view the page in Internet Explorer, all the colors are changed. It looks as if everything has a slight gray layer over it making …

Member Avatar for death_oclock
0
147
Member Avatar for dantheman50_98
Member Avatar for MidiMagic
0
108
Member Avatar for death_oclock

I need to have my background image span the entire length of the page without using the BODY element, here's why: I separated the image into left and right sections so even for different resolutions, the left image will always be on the left, and same with the right. Because …

Member Avatar for MidiMagic
0
140
Member Avatar for vinitt88

Are you trying to emulate a DOS environment using C? Post the relevant code you have already, what it is supposed to do, and what it is doing wrong.

Member Avatar for Ancient Dragon
0
146
Member Avatar for death_oclock

Is there any way to force fwrite() to write in big-endian format no matter what? I am trying to write a MIDI file and they are always big-endian. Converting every value I write to big endian beforehand would be extremely tedious. Ideas?

Member Avatar for mcldev
0
853
Member Avatar for romeyng

There is not a way I know to do this with plain old HTML. Are you using ASP or PHP? You can force the browser to request download rather than just opening the file using some header info.

Member Avatar for almostbob
0
123
Member Avatar for RexxX

You can replace that with a call to [URL="http://cplusplus.com/reference/clibrary/cstdio/rewind.html"]rewind(infile)[/URL].

Member Avatar for kenji
0
89
Member Avatar for jenilgandhi

For the purpose of adding a one dimensional array works well enough in representing a matrix. For more complicated operations though, it would likely be easier to define a matrix like [ICODE]int mat[rows][cols];[/ICODE]

Member Avatar for monkey_king
0
91
Member Avatar for death_oclock

My program is getting hung up somewhere in the function [ICODE]evolveRealization[/ICODE] and while it is stuck its memory usage is increasing by around 1MB per second! While it is building up generations, it was designed to only use the most recent one, and the old ones should be freed. So …

Member Avatar for Ancient Dragon
0
151
Member Avatar for death_oclock

I had forgotten about calloc for the longest time, but I was recently reminded of it. Now i'm curious, what would be the difference between [ICODE]malloc(numElems * elemSize);[/ICODE] and [ICODE]calloc(numElems, elemSize);[/ICODE]? If my knowledge of arrays is correct, there shouldn't be any difference in the memory allocated.

Member Avatar for death_oclock
0
136
Member Avatar for Bladtman242

The first parameter, hWnd (passed NULL) is the window to associate the new process with (NULL means you aren't using this feature). The second, lpOperation, is what you want to do with the file specified in the next parameter. Here we are "open"ing it. Speaking of which, the third is …

Member Avatar for Bladtman242
0
1K
Member Avatar for jam123

[ICODE]char stu_name[10];[/ICODE] is defining just one string that can hold 9 characters. You should define it like [ICODE]char stu_names[10][NAME_LENGTH];[/ICODE]. And no, you should never add [ICODE]system("pause");[/ICODE]

Member Avatar for Alibeg
0
145
Member Avatar for Aamit

Well since this is a PHP forum, i'll give you a PHP solution. You could pass the css file for the iframe to use in the url like so: [CODE=PHP]<iframe id="pframe" width="'.$game['iframewidth'].'" height="'.($game['iframeheight'] + 20).'" src="'.$path.'?style='.$style.'" frameborder="0" scrolling="no" align="middle"></iframe>[/CODE] where style is the css file. In the iframe page, get …

Member Avatar for almostbob
0
336
Member Avatar for sisse56

As soon as I looked at the code, the ugly [ICODE]void main[/ICODE] was staring me in the face. Please fix it in your code, so I can rest easier.

Member Avatar for Freaky_Chris
-1
105
Member Avatar for rgfirefly24

Strings (if you do it the C way) should have a null character ('\0') to show where the end of the string is. Change your definitions to look like this: [CODE=C++] char username[15] = {'r','g','f','i','r','e','f','l','y','2','4','\0'}; // or char *username = "rgfirefly24"; //automatically adds the '\0' [/CODE]

Member Avatar for rgfirefly24
0
97
Member Avatar for cppnewb

Read up on [URL="http://msdn.microsoft.com/en-us/library/bb775493(VS.85).aspx"]common controls[/URL].

Member Avatar for death_oclock
0
87
Member Avatar for geemicah

You can't [I]define[/I] variables in the for loop header, so you need to put [ICODE]int i;[/ICODE] somewhere else.

Member Avatar for death_oclock
0
75
Member Avatar for cool1_best1

O(N...whatever) is [URL="http://en.wikipedia.org/wiki/Big_O_notation"]Big O Notation[/URL]. It is a way of expressing the efficiency (often the "worst case" efficiency) of an algorithm based on the size of its input. O(N) is a linear efficiency, other common ones are O(N^2) and O(log(N)). Note that coefficients are not expressed; you would not say …

Member Avatar for death_oclock
0
105
Member Avatar for ofnature

Yeah, that's really not a wonderful idea. Why don't you base your web blog on a database, and use a C++ program to connect to the database and add a new post that way? Your method depends way too much on hoping that everything will go as planned (window will …

Member Avatar for skatamatic
0
139
Member Avatar for Drahmina

Since this is for a game (high performance required) I would recommend you look at [URL="http://msdn.microsoft.com/en-us/library/ms879875.aspx"]DirectDraw[/URL]. A decent tutorial I know is here: [URL="http://www.falloutsoftware.com/tutorials/dd/dd1.htm"]www.falloutsoftware.com[/URL]

Member Avatar for death_oclock
0
113
Member Avatar for swetharvss

That would be a great plan if you were trying to write bad-looking and terribly inflexible code. You can do this with a loop, however, which will let you find the maximum of any amount of numbers you want. You should keep a variable holding the value that is the …

Member Avatar for death_oclock
0
114
Member Avatar for abhi_marichi

Take a look at [URL="http://msdn.microsoft.com/en-us/library/bb762153(VS.85).aspx"]ShellExecute[/URL] Edit: I misunderstood ArkM's post, I thought it was advising against the use of system() (as is usually the case). I suppose in this case, it would be okay?

Member Avatar for Narue
0
139
Member Avatar for Sky Diploma

Does your page try to run the .exe to generate the new page? Byethost disables the running of executables for some pretty important security reasons.

Member Avatar for Sky Diploma
0
210
Member Avatar for gayatridas

Think about array indices. To write them from beginning to end, you would start at 0 and go to arrayLength - 1. How might you do the opposite?

Member Avatar for moonw3ll
0
139
Member Avatar for cali_dotcom

A good way to implement this is giving each subcategory a reference (field) to the parent category's unique ID. You can do this with an auto-incrementing int field. A root category can just have the parent -1 (for example) to specify that it is at the top level.

Member Avatar for death_oclock
0
127
Member Avatar for shahab.burki

What is your problem? Compile errors? Your node class seems a little off to me also. What are the other pointers supposed to be for? Most linked lists only have pointers to the next and/or previous item (see [URL="http://en.wikipedia.org/wiki/Linked_list"]http://en.wikipedia.org/wiki/Linked_list[/URL])

Member Avatar for death_oclock
0
173
Member Avatar for jaanu.cheruvu

Take a look at the [URL="http://aspell.net/"]aspell[/URL] dictionary.

Member Avatar for death_oclock
0
131
Member Avatar for avadhut_ekal

This thread was about connecting to Access, not MySQL. ODBC allows you to connect to databases with a level of abstraction over the specific database you use, letting you not have to worry about individual APIs.

Member Avatar for hasbro
0
146
Member Avatar for jaanu.cheruvu

[QUOTE=jaanu.cheruvu]Our binary search[/QUOTE] Does this mean that you have one implementation already? Try posting it so we can see what it is you need to modify.

Member Avatar for death_oclock
0
101
Member Avatar for emj83

A better idea, why not just include edge checking code when you count the neighbors? An if statement or two with a simple little condition(s). That way you don't have to start your array at index '1', therefore making it much simpler (especially to someone reading your code, ie. teacher).

Member Avatar for death_oclock
0
96
Member Avatar for theimben

Try looking at [URL="http://hudzilla.org/phpwiki/index.php?title=Advanced_text_searching"]this page[/URL].

Member Avatar for theimben
0
1K
Member Avatar for abby2589

You never initialized the value of x. When is the loop supposed to stop? Stopping at the null character '\0' might be a good idea... Also, you can't have both the loop and and function keeping track of top. You can use a while loop to go through the string …

Member Avatar for Ahmed_I
0
123
Member Avatar for Shanti C

Honestly, you have been given the proper solutions. Sending (and therefore, reading) your forms with the POST method sends variables through the headers sent. For this purpose, however, I would recommend SESSIONs as people could potentially look at the header information. SESSION variables are contained solely on the server (aside …

Member Avatar for Shanti C
0
5K
Member Avatar for phillipdaw

While this is not critical in any way, you should note that the large outputting section at the bottom won't actually print any of the embedded quotes. In this line: [CODE=c++]cout<<"Each ""generation"" eight babies are born with variations." << endl; [/CODE] You are actually writing separated strings but the compiler …

Member Avatar for siddhant3s
0
105
Member Avatar for emhmk1

Just out of curiosity, does this mean that scripts are loaded into the PHP interpreter in their entirety, so that anything can happen to the file during execution and the its execution will be unaffected?

Member Avatar for nav33n
0
113
Member Avatar for Swapsry

I would assume you know how to create forms already. Have the login button send an AJAX request (by calling some JS in the onClick event handler) to a separate PHP login script (passing the username and password) which checks the database, updates session variables, etc. This file can respond …

Member Avatar for death_oclock
0
94
Member Avatar for kshitijkapoor

What about this: [CODE=C]double n = 123.456; int x = (int)(n + .5);[/CODE] If the decimal portion is .5 or greater, the addition will carry it up to the next higher integer. I would think it would be quite a bit faster.

Member Avatar for death_oclock
0
126
Member Avatar for meistrizy

When AncientDragon wrote [ICODE]Code[h] != 0[/ICODE], his code was correct. Yours isn't. Why? AncientDragon's [ICODE]codes[/ICODE] array was a string literal, which automatically has a '\0' or 0 value at the end. Your array does not. Either append a '\0' element or change your codes array to look like AncientDragon's.

Member Avatar for meistrizy
0
166
Member Avatar for danovics

Yep, [URL="http://w3schools.com/ajax/"]Ajax[/URL]. Its amazing how often this is asked in the PHP forum, maybe there should be a sticky...

Member Avatar for danovics
0
72
Member Avatar for FEARmike21

I do not know of any standard function that would perform this task. You could always fix your own code though. Do you understand what you wrote? [CODE=c++]int main (int argc, char *argv[], char **env) { char c, lastc = ' ' ; c = cin.get(); do { cout.put(c); c …

Member Avatar for siddhant3s
0
152
Member Avatar for rickster11

Instead of making us download your .zip file, post some sample lines of the .dat file, including ones that do work and ones that don't (ie. Truman).

Member Avatar for rickster11
0
146
Member Avatar for bossie09

Be careful to note that in math.h, these functions expect the angle in radians, not degrees.

Member Avatar for csurfer
0
171
Member Avatar for cppStudent

My best guess, without seeing this in context, is that it is to define a two-dimensional array. It is very unlikely that you will see pointers to single ints (unless you're trying to pass them by reference the 'C' way). In this case, you have one large array with lots …

Member Avatar for death_oclock
0
147
Member Avatar for skitzo315

Replace "persons.txt" with a string variable containing the filename you have gotten from the user. I hope you know how to get user input... By the way, code tags should look like this: &#91;code=c++&#93; ...your code... &#91;/code&#93; The fact that you tried is appreciated, however :P

Member Avatar for siddhant3s
0
314
Member Avatar for chriscross86

I hope that you at least recognize the importance of the programming concepts rather than memorizing the text of the book, like your neurotic teacher seems to think.

Member Avatar for Dewey1040
0
102
Member Avatar for Brandon515

For me, this problem only occurred when I entered more than 100 characters. Try adding this: [CODE=cpp] if(cin.fail()) cin.ignore(256, '\n'); [/CODE] just after you read the filename. Other things wrong with your code: -Don't use system commands. Just don't. -You are letting the user input 20,000 characters into a 2,000 …

Member Avatar for death_oclock
0
105
Member Avatar for Aamit

So you want to provide a common portal to all three sites within your own? Use [URL="http://us.php.net/manual/en/function.fsockopen.php"]Sockets[/URL] to connect to their servers, get the page you want (while sending the info they require), and process it for the info you want.

Member Avatar for Aamit
0
105
Member Avatar for designingamy
Member Avatar for death_oclock
0
92

The End.