- 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
155 Posted Topics
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. | |
Re: Sounds like your library installation is broken or you have not set up your compiler/linker environment properly. These problems are usually easy to fix with a little persistence. Make sure you read all installation instructions carefully for the library, specifically the part about integrating with your platform's IDE or compiler. … | |
Re: This is a less complicated way to do the same thing... [CODE] int a=320; printf("%d",(char)a); // Only return the first byte of the integer using a cast [/CODE] "Type Punning" as in your example is best used for random access of said bytes. [CODE] int a=320; char *p; p=(char *)&a; … | |
Re: I usually create a structure (with malloc'd arrays if required) and either define the function with that typedef or as a void pointer. Void pointers are a powerful way to pass literally anything to a function, but usually in those cases you need to also pass some enum or int … | |
Re: I haven't studied your code in detail, but I should point out that you should never create static buffer array's with arbitrarily large sizes. This is especially true for a function that deals with files. Instead, define a pointer and use malloc/realloc/free to manage its size dynamically so you can … | |
Re: [QUOTE=Santi1986;1698103]got it...storing the next node in temp...copy data of next node to this random node data field....[/QUOTE] Impressively written! So robotic, so exotic. | |
Re: This is a simple implementation of a switch-based scientific notation parser I came up with. I put lots of comments in there so you can build upon it and do more with it. I have tested it and it works fine with all your example inputs. [CODE]double ScientificToDouble(char *in_String) { … | |
Re: Here are a few approaches to your described problem: 1. Write a program in assembly that uses Operating System API facilities or Graphic libraries to draw to the screen (As Ancient Dragon described) 2. Write a program in assembly that writes directly to the monitor by writing directly to video … | |
Re: C is not FORTRAN: It is not "made for mathematics". C is a system programming language, and as such, you must understand that it can't magically figure out what relationship your functions [B]f()[/B] are to each other by context. To make this work in C, as [B]WaltP[/B] explained, you must … | |
Re: Explained is the standard in the industry. It is also the general philosophy of successful application programmers. As a perfectionist, I have a loyal customer base due to them knowing that I don't follow that philosophy. Being a perfectionist also makes you older faster and less financially successful in the … | |
Re: I would recommend that you use the [URL="http://www.imagemagick.org/script/binary-releases.php?ImageMagick=6t1724la0l35ojifcsr311hr15#windows"]ImageMagik Library[/URL] in Windows to get image properties. It supports practically every image format and will convert image types to a raw image format on the fly so that your image viewer program can support all those image formats. Read their documentation on … | |
Re: Here you go! [CODE] #include <stdio.h> int main(int argc, char** argv) { printf("Hello World\n"); return 0; } [/CODE] | |
Re: The better question is: Can anyone HELP me with the logic to solve common emitter biasing of a BJT? Logic is language independent. With that said, use this open source Java applet to help you with an accurate BJT simulation: [url]http://www.falstad.com/circuit[/url] The source code is available on the site. | |
Re: You are also missing details from your question, and it could be interpreted many ways: 1. A function that will display all the vowels from the string in the order used. 2. A function that will display all the distinct vowels from the string. 3. A function that will display … | |
Re: If what you mean is that you want to fill list[0][0] through list[0][9] with 5.35f, then use a for loop and assign 5.35f to each int from 0 through 9 on row 0. | |
Re: Because [B]b[/B] is being passed a new instance rather than a reference pointer. You can fix that like this: [code] #include <stdio.h> main( ) { int a[5], i, b = 16 ; for ( i = 0 ; i < 5 ; i++ ) a[i] = 2 * i ; … | |
Re: [QUOTE=tayler;1651408]make a program that have a password before you wiil enter the main menu and in the main menu there is 4 sub menu ....plz help me.......plzzzzzzzzz[/QUOTE] 1. You should have made a new thread and provided a link to this post in your thread since you are requesting something … | |
Re: You could do it with this: [url]http://itextpdf.com[/url] It's free, powerful, and highly flexible. You should read their book to know how it works, but there is plenty of resources on the internet. | |
Re: By now the OP is teaching Object Oriented Theory at a University. | |
Re: I am pretty sure you are using the wrong term. In C, if a function's return value is expected but not properly returned, the register that normally contains the return value will contain an undefined value which is basically whatever the register has in it before it left the function. … | |
Re: Instead of flipping the number, save the number in reverse so it can be automatically printed in the reverse order. |
The End.