5,237 Posted Topics

Member Avatar for smithag261

Horribly broken, without code tags, unindented code no less. Apart from the broken printf call with the incorrect use of &, where is the increment to i to stop it being an infinite loop?

Member Avatar for WaltP
0
479
Member Avatar for hina-pande

Claiming "urgency" isn't our problem, just because it's your problem. [url]http://www.catb.org/~esr/faqs/smart-questions.html#urgent[/url] Spending a bit more time on composing your post is a good thing. [url]http://www.catb.org/~esr/faqs/smart-questions.html#writewell[/url] As is, being more specific about your problem. [url]http://www.catb.org/~esr/faqs/smart-questions.html#beprecise[/url] Eg, stating your operating system and compiler is a pre-requisite. > is there any way how …

Member Avatar for Salem
0
117
Member Avatar for jamello

Some people might like the equality, but not the sum... [code] #include <stdio.h> int sum ( const char *p ) { int result = 0; while ( *p ) { result += ( *p++ - 'A' + 1 ) * 9; } return result; } int main ( void ) …

Member Avatar for jamello
1
482
Member Avatar for pixrix
Member Avatar for pixrix
0
1K
Member Avatar for aasi007onfire

Use fgets() to read a line of input into a buffer, and check the result. Use strchr() to step from one delimiter to the next for example. Use strncpy() to copy string fragments, and make sure that a \0 is appended. Write your own version of strncpy() which automatically appends …

Member Avatar for praneeth_gunda
0
121
Member Avatar for StockBreak

I guess in your rush to spam multiple message boards [URL]http://www.tek-tips.com/viewthread.cfm?qid=1382444&page=1[/URL] with the same question, that you couldn't be bothered with simple courtesy of reading the posting guidelines on any of them. [URL]http://www.daniweb.com/forums/announcement125-3.html[/URL]

Member Avatar for Ancient Dragon
0
401
Member Avatar for Hamrick

Did you compile the debug code, or the release code? Did you disable the stack checking? - the diagnostic checks for stack overflow and/or stack corruption will dominate the time for small functions. In anticipation of your next question (how do I disable...), which version of Visual C++ are you …

Member Avatar for Hamrick
0
291
Member Avatar for bvgsrs

The array will still be passed as a pointer, no matter how you declare the function prototype / formal parameter. [INLINECODE] int GetValues (int a[MAX][MAX]) int GetValues (int a[][MAX]) int GetValues (int (*a)[MAX])[/INLINECODE] are all equivalent to one another. The first is easy to remember because it is simply copy/paste …

Member Avatar for Salem
0
113
Member Avatar for vladdy19

Yeah, read this [url]http://www.daniweb.com/forums/announcement8-3.html[/url] Then edit your post so we can tolerate reading several thousand lines of code. Most people just ignore unformatted code, especially when there's so much of it.

Member Avatar for Salem
0
212
Member Avatar for narendharg

But if Linux is the OS running on your AT91RM9200 microcontroller, then there are no physical interrupts you can get access to. All user-mode programs live in a nice virtual world well away from the hardware. Unless you're talking about a kernel-mode device driver for some new device you've attached …

Member Avatar for Salem
0
113
Member Avatar for nalinibh

For trivial programs, using clock() is like using a sun-dial to measure the speed of a Ferrari - "Why is it always 0, because it's too damn fast that's why!". Even the most optimistic precision (not accuracy) figures for clock() are at least 1M times slower than the clock frequency …

Member Avatar for thekashyap
0
454
Member Avatar for lotsofsloths

> When someone who knows how to do it and is interested enough to help you comes along I read it yesterday, but I wasn't interested enough to answer. I read it again today, and I'm rapidly losing the will to care, what with all the bumping. > and finds …

Member Avatar for Swapnil6623
0
134
Member Avatar for devesh9392

First random guess is you've reached the max number of open files you're allowed to have because you're not closing any of them.

Member Avatar for devesh9392
0
147
Member Avatar for nalinibh

[URL]http://leto.net/docs/C-optimization.php#Gotchas[/URL] Read that bit first, then read it from the top. Then get yourself a profiler, run the program with meaningful data sets and ask yourself what it is that you really want to achieve.

Member Avatar for Salem
0
98
Member Avatar for Covinus

Perhaps start by saying what kind of program you're writing (console, GUI) and for which Operating System. It's really hard to make sensible suggestions without a decent level of background information.

Member Avatar for Salem
0
111
Member Avatar for aasi007onfire

Essentially, it's about programmer choice. Originally, it went something like: Choose 'short' if you are concerned about the amount of storage taken up. Choose 'long' if you are concerned about the numeric range of the data. Choose 'int' if you are concerned about choosing the 'best' performance. The common assignments …

Member Avatar for ~s.o.s~
0
110
Member Avatar for ss339

> so this implies i've selected a worthwhile career. Being good (or at least competent) in C++ is a good career move. Before you decide on games, you'd better check the body count. [URL]http://en.wikipedia.org/wiki/List_of_commercial_failures_in_computer_and_video_gaming[/URL]

Member Avatar for Salem
0
103
Member Avatar for mot_ala

Your question is so incoherent, all I can suggest is you paste the title into a search engine and start reading. [url]http://clusty.com/search?query=+Firmware+Over+The+Air&sourceid=Mozilla-search[/url] Plus, since you didn't ask a language specific question, it's off-topic in the C forum.

Member Avatar for Ancient Dragon
0
18
Member Avatar for laugh

Consider writing a version which runs on your PC first, to get all of the logic sorted out. With practice, you can do this well enough that the amount of work you need to do to get it to also do the same thing on your target is pretty minimal. …

Member Avatar for Salem
0
104
Member Avatar for jaepi

> GetDiskFreeSpaceEx() Dunno, but the 'df' command line program provides this information. If you could locate the Linux source for that program, perhaps you'll find out how it's done. > GetFileAttribute() Use the stat() API as described already. Should be good for regular files and directories. Remember, if it returns …

Member Avatar for jaepi
0
707
Member Avatar for laugh

> void main(void) Actually, it may be just fine as it is. > The microcontroller i'm using is PIC18F4620. This qualifies as a "freestanding" implementation. So long as main, or whatever the documented entry point is, is declared in a manner consistent with that implementation, then it should be good. …

Member Avatar for Salem
0
123
Member Avatar for sadaka

objc is for Objective C (sort of like C++, only different), yet your code looks like C++ proper. Which compiler are you using. If it's a command line compiler, paste your command line (or some compile logs if you're using an IDE).

Member Avatar for Ancient Dragon
0
141
Member Avatar for bops

Well if you're calling it with a string constant to test it, eg [inlinecode] processString("hello|world");[/inlinecode] Then yes, it will fail because string constants are really constant, and the OS will halt your program if it even tries. Try something like [inlinecode]char test[] = "hello|world"; processString(test);[/inlinecode] If that isn't it, you …

Member Avatar for Narue
0
117
Member Avatar for byomokesh

Are you using something like this to parse your XML? [url]http://search.cpan.org/~msergeant/XML-Parser/[/url]

Member Avatar for byomokesh
0
164
Member Avatar for RicardoDiaz

> practice.asm:6:End-of-File not at end of a line Open the source file in your text editor Go to the very end of the file and press the "enter" key. Save the file and try again. > And an output file: "a.out", I ran a.out and I got this message: The …

Member Avatar for RicardoDiaz
0
193
Member Avatar for Ruso1636

If I said you need to convert each 8:8:8 colour into 3:3:2, would you have any idea what I was talking about? In other words, how much of the basics do you already know?

Member Avatar for Ruso1636
0
130
Member Avatar for Xeon1st

> beqz $t5,exit #if char in array(i)=null 1. This test should be first 2. Should it be testing $t3, what you loaded from the array? > lb $t3,array($t1) Earlier, you assigned $t3 to be the lower bound, and now you're trashing it.

Member Avatar for Xeon1st
0
157
Member Avatar for meiyantao

> Do you have any good idears to prevent it?help me please! Yes, you use fgets() in C, and getline() in C++ Both of which allow you to specify the maximum length of input. > C and C++ can not prevent the memory from overflowing Only if you use the …

Member Avatar for Narue
0
251
Member Avatar for matias.germany

> i=(abcdario[g]+h)%27; The array is an array of structs, so you need something like [inlinecode] i=(abcdario[g][COLOR=Red].min[/COLOR]+h)%27;[/inlinecode]

Member Avatar for Ancient Dragon
0
127
Member Avatar for stanats

If the text file is large (and constant), and you need to do this a lot, then reading the whole file once to produce an index is worthwhile. The index being all the 'tell' positions for the start of each line, so at some future time, you can just 'seek' …

Member Avatar for echobase
0
2K
Member Avatar for youngstorm

Is there any online documentation for those syscall's, like 4 means print a string. Check that 5 (which I presume means 'read') does what you think it should do. My guess is you should be passing a buffer and a length to it.

Member Avatar for youngstorm
0
3K
Member Avatar for richie2021

> i now get a segmentation fault when i run the code, and idea why that is and how i fix it Check the result of each strtok() call before trying to use it with strcpy(). If your input is mal-formed, then you will be in trouble. Also, note that …

Member Avatar for richie2021
0
127
Member Avatar for ptimoor

Perhaps start by reading said link, and some of the follow-on material. Then ask a specific question about your lack of understanding, on an appropriate forum. There is no "mind meld" technology where you can hope to know what someone else does simply by posting one line of cryptic text. …

Member Avatar for ~s.o.s~
0
77
Member Avatar for tlee

> Ok , ok so I failed to look at the datestamp of egemen's post -- three months old Yeah, a 3 month bump, which in itself began as a bump of a 3 YEAR old thread. I bet Jack knows how to spell his own name, regardless. #include <topic.h> …

Member Avatar for Ancient Dragon
3
2K
Member Avatar for jlb_2_99

[url]http://www.daniweb.com/techtalkforums/announcement118-3.html[/url] The first won't even compile. The second trashes memory, so even if it "works for you", it's still wrong.

Member Avatar for John A
0
129
Member Avatar for jaepi

Don't tell me that xor hack is in production code. [url]http://c-faq.com/expr/xorswapexpr.html[/url]

Member Avatar for jaepi
0
171
Member Avatar for alembic21

Read this - [URL]http://www.daniweb.com/techtalkforums/announcement8-3.html[/URL] Then edit your post to improve the presentation.

Member Avatar for ndeniche
0
135
Member Avatar for FC Jamison
Member Avatar for Micko

> mat1 = malloc(cols * sizeof(int*)); You've got the rows and cols mixed up in a couple of places.

Member Avatar for Micko
0
155
Member Avatar for sundar divas

It's just simple maths [code] void process ( int a, int b ) { char var[10]; process( 0, 0 ); } [/code] You have a char array, so that's 10 bytes. Two integers - say 4 bytes each (total 8). Each call has a fixed overhead of several bytes (say …

Member Avatar for vijayan121
0
104
Member Avatar for Jishnu

I suppose we'll have to wait a while longer for you to discover indentation as well as code tags :icon_rolleyes: Also, whether you intend this to be a C program or a C++ program (and not some random mix like it is at the moment).

Member Avatar for Salem
0
72
Member Avatar for pretu

It's a meaningless question without some idea as to what your OS / Compiler / Hardware actually is. Unless you want something vague like [code] struct pixel { char r, g, b; } screen[ROWS][COLS]; void putpixel ( pixel p, int r, int c ) { screen[r][c] = p; } [/code]

Member Avatar for Salem
0
363
Member Avatar for Matt Tacular

> i tried just iostream and it said cout was undefined... Well you also need to learn about namespaces as well. A crude "fix" is to convert [inlinecode]#include <iostream.h>[/inlinecode] to [inlinecode]#include <iostream> using namespace std;[/inlinecode] Better use would be only list the things which interest you. [inlinecode]#include <iostream> using std::cout; …

Member Avatar for Salem
0
149
Member Avatar for faisaly
Re: Help

Also, pick better subjects. [URL="http://catb.org/%7Eesr/faqs/smart-questions.html#bespecific"]http://catb.org/~esr/faqs/smart-questions.html#bespecific[/URL] You may as well have posted a blank message for all the good that "help" does. > [COLOR=green]Write a macros in which swap two number without using 3rd variable [/COLOR] Not this old chestnut. malloc and crusty macro hacks in C++ - I'm really not …

Member Avatar for Salem
0
107
Member Avatar for ghadahelal

[URL]http://msdn2.microsoft.com/en-us/library/Aa364418.aspx[/URL] Then lookup [URL="http://msdn2.microsoft.com/en-us/library/Aa364418.aspx"]http://msdn2.microsoft.com/en-us/library/aa364428.aspx[/URL] and finally [URL]http://msdn2.microsoft.com/en-us/library/aa364413.aspx[/URL]

Member Avatar for ghadahelal
0
138
Member Avatar for Woobag

> int a[sizex][sizex]; The first problem is standard C++ doesn't allow variable sized arrays. Though some compilers offer it as an extension. > for(int i=1; i<sizex; i++) The second problem is that array subscripts start at 0, not 1.

Member Avatar for Woobag
0
2K
Member Avatar for raj1324

> hurry up [url]http://catb.org/~esr/faqs/smart-questions.html#urgent[/url] > does gcc compiler support graphics file ? No it doesn't - not by itself. So you're going to have to a) learn some netiquette b) say which operating system your gcc is running on.

Member Avatar for happygeek
0
182
Member Avatar for ashkash

Look in your assembler reference for operations like 'rotate', 'shift' and 'and'

Member Avatar for Salem
0
52
Member Avatar for lilmiss
Member Avatar for jwenting
0
141
Member Avatar for Zay

Maybe it's something to do with the fact that your array is an array of bytes, yet you load using eax (which is 32-bits IIRC). When you say it doesn't work, try to explain in more detail what you see and what you expect. I mean, the first value printed …

Member Avatar for Ryu
0
137

The End.