- Strength to Increase Rep
- +8
- Strength to Decrease Rep
- -2
- Upvotes Received
- 38
- Posts with Upvotes
- 32
- Upvoting Members
- 26
- Downvotes Received
- 4
- Posts with Downvotes
- 4
- Downvoting Members
- 4
- Interests
- Everything
- PC Specs
- Obsolete
Re: Whenever I want to optimize a program, I usually start by trying to map the entire problem mathematically, simplify it, then re-code the simplified formula. I don't have time right now to look at your code, but maybe that bit of advice might help you. | |
Re: [QUOTE=cse.avinash]pleaser close this thread its too old(4 yrs) now.....[/QUOTE] Normally I would say the same thing, except that most of the "bump" comments were praising the information on this thread. While that isn't adding anything useful to this thread, it takes effort to browse Google, find this information, and feel … | |
Re: Why don't you take the printScreen function out of MDAnalysis.c and move it into driver.c after the main function. It could fix your problem perhaps. | |
| Re: Setting global environment variables are OS specific, and are essentially managed by the OS itself. The OS is responsible for passing on the default environment values to new process spaces. Therefore you will want to refer to your Operating system's requirements. In [Windows](http://best-windows.vlaurie.com/environment-variables.html) it is stored in the system registry. … |
Say I have code like this... typedef struct { unsigned A:1; unsigned B:1; } FlagStruct; extern FlagStruct *Flags; Imagine that the Flags instance is a shared resource in a multi-threaded application. Say thread #1 decides to read the value of Flags->A but thread #2 decides to set or clear Flag->B … | |
| Re: You may be suprised how heavily used console interfaces are used in these modern times. I work with them and build them on a near daily basis in Linux for high end modern enterprise software. As much as I love building things from scratch, I also consider the value of … |
Re: Que: What is the exact difference between the "for" loop and "while" loop in C language ? Ans: About 20 lines of code. [I][B]Ba-dum-PSS![/B] *Insert laughter Here*[/I] [url]http://www.codingunit.com/c-tutorial-for-loop-while-loop-break-and-continue[/url] | |
Re: I looked up the word "plz" in the dictionary and it does not exist, especially not one with that many letter "Z"s. Note that the question in this thread has already been answered 2 years ago. Why can't you use that code as a starting point? | |
| Re: Just a quick word of advice. It is more efficient to use fwrite() or fputc() instead of fprintf() for writing characters to a file one at a time. This is because fprintf() needs to parse the format string whereas fwrite() and fputc() does not. This only matters if you plan … |
Re: These instructions assume you want to read it to memory and that the letters are being converted into numbers of equal size (1 byte): 1. Open the file for reading 2. Create a string array large enough to store the contents of the file. 3. Iterate through each character of … | |
Re: Note that system() returns a program status code. It is good practice to use this value for error handling. | |
| Re: I believe Labdabeta answered the first question well. As for your second question you can technically do this... const *p = (const *)0x05; // Constant pointer address char *a = (char *)p; // Assign this address to a character array printf("%p", a); // View the address of the character array … |
| Re: Integer has nothing to do with pointer size. The pointer is the size of the memory address as dictated by the Operating System based on the CPU's capabilities. A 32 bit CPU will have a 4 byte address whereas a 64 bit CPU will have an 8 byte address. Some … |
| |
| Re: Its funny to think that c=(--a)+(--a); is not any more efficient than --a;--a;c=a+a; in terms of how it compiles. Its just that the first version is ambiguous in design as (--a) acts as a function with a side effect rather than as a variable in an algebraic formula. Ever since … |
Re: I'd start over from scratch with this strategy: 1. Load the entire file into an array of strings. Create a new line for every newline character found. Don't bother with scanning it or doing anything else other than load those lines into memory. If you do this then it lessens … | |
Re: Pseudo code, Flow charts, etc are nothing more than a human legible medium to stage the logic so that it can then be translated into code. For instance you can translate this human readable line... **Ask the user for a floating point number** into this code... printf("Prompt: "); scanf("%f", &Variable); … | |
Re: I'm curious if your shell is merely echoing commands to another shell. What does this shell do with the commands it receives? Are they translated into a system API or some library? Knowing this would help in deciding the best way to manage the command history. | |
Re: I will disagree with Acient Dragon on this one. DOSBox runs native DOS games pretty well, so you have to ask youself "what am I doing differently than these other DOS programs"? I haven't programmed in DOS in forever so I can't say exactly whats wrong, but to just give … | |
Re: This is illegal unless you are working on an embedded system or a very low tech system that only works with 1 byte addresses: typedef BYTE SOCKET; And unless you are reinventing the wheel you should not be actually defining a typedef for SOCKET. Its defined in your socket library … | |
Re: I just want to add that DaniWeb has an often neglected "search" feature which you might find handy. I did a search just now for your question and found literally over 1,900 results! You should definately follow myk45's advice and learn the language grammar thouroughly before you embark on any … | |
I am importing some C code into a C++ compiler, specifically Borland C++ Builder 5. I seem to have a problem with this style of code: // A structure that contain's itself typedef struct AnObject AnObject; struct AnObject { AnObject *Object; }; // A global structure to store a pointer … | |
Re: If you know any [URL="http://www.ubuntu.com/"]linux[/URL] scripting, you might be able to write a simple [URL="http://www.freeos.com/guides/lsst/"]batch script[/URL] utilizing the [URL="http://linux.about.com/library/cmd/blcmdl1_diff.htm"][B]diff utility[/B][/URL] which outputs the difference between two files. The [B]diff[/B] utility can ignore white spaces and non-typeable characters making it quite ideal for the job. You may write the script to … | |
Re: There is no excuse not to say anything in a help forum. We are not robots: we don't communicate in code. If you are not comfortable with the English language, its okay. We will not criticise your speech. But you must explain yourself, otherwise you are just spamming the site. | |
Re: Next time you post code, use the [ CODE ] Tags. The code you posted is terrible. Not only is it highly inefficient but the variable names are undescriptive and there are no comments anywhere to be found. Either way, the "count" variable is apparently used to store the number … | |
Re: > [B]now three variables we printed to a file received from the user. This variable to another file, the user wants to take that file and the value of the variable is a variable, you need to do. And this event is the first change the variables in the file … | |
Re: Sounds like fun. How is that going for you? Show us what you have so far. | |
Re: If you have any specific questions from the book, you should ask them here. We would be happy to help you. It is not the nature of DaniWeb to give out answers, especially instructor's manuals. | |
Re: You could always use a library like [URL="http://www.libsdl.org/"]SDL[/URL] (its portable) and lets you capture the keystrokes and mouse of the computer without displaying anything. | |
Re: [QUOTE=amit_as;1696555]how to find the position of a particular character in a given string in c[/QUOTE] Show an attempt at trying to do this yourself. It is more useful then just asking for the answer. |