949 Posted Topics

Member Avatar for moroccanplaya

"archive" is a string, and so scanf("%s", archive); is correct. Remove the ampersand from in front of your "archive", in that line of code. Same is true for "original file", in line #9. Remove the ampersand. The address will be correct, but the pointer will be of the wrong type. …

Member Avatar for moroccanplaya
0
112
Member Avatar for abhijit (EEE)

Don't you have documentation that gives you the info like this? Since your question is about a hardware problem, I would ask it, in a hardware or embedded forum. Although I'd like to help, I am not familiar with that hardware.

Member Avatar for vinayakgarg
0
136
Member Avatar for leedsfanatic

You could include <stdlib.h> and then malloc the memory for buff[]. When you no longer needed it, you could then free(buff). That would save a lot of the static memory space, which is much more scarce than heap memory, (where malloc() gets it's memory for you).

Member Avatar for peter_budo
0
118
Member Avatar for NickPatton

I don't have that strptime() function, so I suggest: 1) Use an unsigned long for the seconds' data type. Int may over-run. 2) Once you get the number of days, (or whatever units you want to work with, just do the math yourself: seconds +=hoursPerDay * secondsPerHour, + etc.

Member Avatar for NickPatton
0
233
Member Avatar for salvador01

Consider the number 123: [CODE]while number is greater than 0 one = 123 % 10 number = number/10 //remove the digit in the one's place from the variable number. loop [/CODE] That's all there is to it. It peels off the digits, one by one, from the right hand side. …

Member Avatar for sharathg.satya
0
104
Member Avatar for trust_noone

You'll have to give more info than that! Not related to the "Mummy" are ya? ;)

Member Avatar for Trentacle
0
92
Member Avatar for TomaCukor

If the test portion of the while(test in here) doesn't resolve to 1 (true), then the inner part of the while() loop will not be entered by the program. So, is t[jcs] > 100, right at the top of the first loop? And somewhere in the while() loop, you want …

Member Avatar for WaltP
0
265
Member Avatar for rtk1865

Change your %f, %s, %s to %f%*c %s%*c %s The %c handles the ',' char, and the * modifier in front of the c, should tell fscanf(), not to store the char. [CODE]fscanf(filePointerName, "%f%*c %s%*c %s ", &myFloatVariable, myString1, mySring2);[/CODE]

Member Avatar for Narue
0
23K
Member Avatar for phobos666

Did you forget to open the file? ;) [CODE]fp = fopen("myfileName", "r"); if(fp==NULL) { printf("Unable to open the file\n"); return 1; //or use exit() if needed } [/CODE]feof() may repeat your last value, check your return type from fscanf() and if it's less than it should be, break out of …

Member Avatar for Narue
0
131
Member Avatar for ateryad

This is a C forum, not a C# forum - move down the forum list just a bit more.

Member Avatar for Narue
-1
77
Member Avatar for moroccanplaya

Any C tutorial would include this. Google up a bunch, and have at it. If you have a particular question, post up your attempt to do it, and let's see what the particular problem is. There are scores of good C tutorials on the web. Which are appropriate for your …

Member Avatar for Adak
0
100
Member Avatar for varma1993

If you want sorted strings, then you have to compare them as strings, not as individual char's. You can see the problem: Abbey should sort out lower than Cathy, but when you are comparing the 'b' in the second letter of Abbey, with the 'a' in the second letter of …

Member Avatar for Adak
0
116
Member Avatar for arshi9464

Each structure has it's advantages - and disadvantages. It's like what you drive. You'd want a race car for racing (great for speed and handling), but a diesel truck for towing (loads of low end torque), the heavy loads.

Member Avatar for Jason Giggs
0
189
Member Avatar for salvador01

Perhaps the easiest way of doing this is to use [CODE]fgets(charArrayName, sizeof(charArrayName), stdin);[/CODE] to get the number into a string format. Then just "walk" the charArrayName[] char by char, and add up the values as you go (into an integer variable). For your answer, remember to show it using %d, …

Member Avatar for prvnkmr194
0
113
Member Avatar for shanki himanshu

Without knowing you, your ability in C and the sciences, or your class, I don't see how we can be of much help. The start must come from you! Look at things on sourceforge.net, and google up other idea's for a project, as well. Talk to your classmates, etc. What …

Member Avatar for Kamatari
-8
134
Member Avatar for Hey90

[CODE] #include <stdio.h> #define MAX 20 /* prototype your struct in global scope, above main() */ struct company { float east,north; char name[20],place[20]; }; int main(void) { struct company site[MAX]; //instantiate it in main() - good FILE*file; int i=0; file = fopen("companies.txt" ,"r"); while(fscanf(file,"%s %s %f %f",site[i].name[0],site[i].place[0], &site[i].east, &site[i].north)) == …

Member Avatar for Adak
0
803
Member Avatar for omkar1987

A few suggestions: malloc() is defined in the include file "alloc.h", not "malloc.h". ;) Without the stdio.h include file, I'm not surprised you're having problems opening files and such. ;) After you malloc() for an array (especially after such a large one), be sure to check the returned pointer address …

Member Avatar for Narue
0
173
Member Avatar for arnas

First, dice IS plural - die is singular. There is no "dices". Sure, you can check each char in the string, to see if it has only certain char's. A check function might look like this: [CODE] /* where 5 is the size of the input array. */ int checkStr(char …

Member Avatar for WaltP
0
205
Member Avatar for bill13

@kalai: click on the code tag icon in the editing window, and paste your code in between the code tags. Makes your code easy to read and study, and not look like html text and all squished to the left hand margin.

Member Avatar for Mohtadeen
0
281
Member Avatar for mg120

I suggest using chess fonts - google, download them. For a 2D chess board, a console window will be OK, but the visual quality of the pieces really suffers if you don't have chess fonts installed. Using something like Winboard (a chess program interface for chess playing programs without them), …

Member Avatar for msaqib
0
225
Member Avatar for dcarrawa

I know Perl is famous for "batteries included", but C is famous for rolling them little batteries right along, as well. ;) If you're going to have to re-write it, consider just using C.

Member Avatar for dcarrawa
0
254
Member Avatar for moroccanplaya

I believe what you want is available from the programs that create archives. I'm talking about zip, rar, pak, and all the rest. Google up a website that deals with these archive makers and their algorithms, and dig in. I'd be sure to include Wikipedia in that search. Whatever content …

Member Avatar for Dervish1
0
84
Member Avatar for kapilsolanki84

The thing is, there aren't too many programs that don't need a console window, at least. Oh! I know one - a key logger!! No, I won't be helping you. ;)

Member Avatar for VernonDozier
0
213
Member Avatar for tastyTreeHUGGER

The best way to sort structs, is to NOT sort the structs. ;) Sort an index array of simple int's, instead. This is an example of "sorting" by the index. No data is moved in the process (the original order is retained). All the data can be written or displayed, …

Member Avatar for Adak
0
427
Member Avatar for TrueCoding

Needs a bit of touch up: [QUOTE=TrueCoding;1411656]Basically this is the code but its not displaying my array just some random numbers. [/QUOTE] Let's use MAX of 10, so you don't have to enter lots of numbers yet ;) [CODE] # include <stdio.h> # define MAX 10 int main(void) { int …

Member Avatar for Adak
0
109
Member Avatar for searchfgold6789

You probably don't want to hear this, but I feel obligated to say you should move up to a more robust language. QBasic (unless it's the rarer QBasic Pro version), can't even create an executable file. Lots of ways to do this. Maybe something as simple as this: Your data …

Member Avatar for Rich_ch47
0
116
Member Avatar for atramposch

Thanks for this thread - I love it! ;) Intuitively, you sense that there's a better way (and right you are), but can you find it (and using just the array and indeces)? There is a relationship between i and j that is missing - but what could it be?? …

Member Avatar for Adak
0
109
Member Avatar for sh4rif
Re: A

Watch out! The obvious patterns here are looking to bite you! ;) You need to put some effort into this. We don't serve as homework bwitch's. We help people who are willing to show some real effort.

Member Avatar for Sgouros
0
93
Member Avatar for Joey_Brown

Go through the array twice: First time, count the number of times each letter appears. That's easily done using logic like this: [CODE]for each row for each columm ascii[this letter's ascii value]++, coded like: ascii[myLetter]++; end for end for [/CODE] (a 256 element array of type int, will do nicely …

Member Avatar for Joey_Brown
0
125
Member Avatar for moroccanplaya

Greater than 0, not less than: [CODE] while ((n = fread(buffer,1,sizeof buffer, original_pointer)) < 0) [/CODE]

Member Avatar for moroccanplaya
0
157
Member Avatar for rukia020

This is not a "do my homework for me" forum. Either show your effort to solve this assignment, or resign yourself to disappointment.

Member Avatar for Shankye
0
2K
Member Avatar for jeremy62

What I like to do is call menu() function from main. Menu() is just a BIG while(1) loop, with code to exit when the user requests it. Inside the while loop, it prints the header or banner, the menu options, and has a big switch (choice) block of code, to …

Member Avatar for Shankye
0
263
Member Avatar for rafi1082

[QUOTE=rafi1082;1404423]hello again i got an assignment i thought i understand it but the every time i read it i understand it differently. my teacher won't explain the exercise. here is the exercise [IMG]http://img42.imageshack.us/img42/8331/37255827.png[/IMG] he also gave an input output example located here [url]http://rapidshare.com/files/434579925/sorted.zip[/url] i'v learned using shmat & shmget and …

Member Avatar for Adak
0
130
Member Avatar for moroccanplaya

The specifics depends on how your program is structured, which you haven't posted, or described in the detail that's needed. Post your program's code, and give us an example of what you want to do: *input you have *processing you want *output you want Please, not just a description - …

Member Avatar for moroccanplaya
0
113
Member Avatar for dubery

Oh hell no! ;) ** Welcome to the forum, Dubery! ** Here's what I want you to do - start with just one number variable, and have the function call itself, until the number is 5, and print it. You won't learn crap by having someone else do the recursive …

Member Avatar for dvillase
0
117
Member Avatar for kalpana sathiya
Member Avatar for harikrishna439

Do you want to use the %x or %X (hexadecimal) format in printf()? [CODE]printf("\n%x/%x \n",numerator, denominator); //or X for upper case letters[/CODE]

Member Avatar for sharathg.satya
0
111
Member Avatar for ritcherjd

[QUOTE=raju_devolla;765275]my advice is that for a beginer first get an binary file of an image and read the file and display using put pixel statement in c. As u r going to display black and white image u need to set an threshold value above which all the values should …

Member Avatar for angelique28
0
1K
Member Avatar for moroccanplaya

[CODE] mkdir Creates a directory. Syntax: int mkdir(const char *path); Prototype in: dir.h Remarks: mkdir creates a new directory from the given path name path. Return Value: mkdir returns the value 0 if the new directory was created. On error, a value of -1 is returned, and the global variable …

Member Avatar for moroccanplaya
0
132
Member Avatar for Unidennn

In this code: [CODE] typedef struct point CIRCLE; [/CODE] did you mean: [CODE] typedef struct circle CIRCLE; [/CODE]?? ;) ;) Funny, but I've done that kind of stuff many times, myself. In C, it's always int main, never void main, and with a return 0 at the end. You should …

Member Avatar for Adak
0
203
Member Avatar for tastyTreeHUGGER
Member Avatar for tastyTreeHUGGER
0
453
Member Avatar for Hayzam_#include

Hop in your time machine. Set the date for about 1999. Look into WindowsME, and earlier versions of Windows. After that, the NT kernel came into use from the server line, and that pretty much ended these kinds of shenanigans.

Member Avatar for Ancient Dragon
-1
238
Member Avatar for becka221

The key is in the file names themselves: data-01.txt, data-02.txt... to data-20.txt. Use a char array fname[MAX] to construct each of your filenames: [CODE] char fname[12] = {"data-"}; //leave for for the end of string char: '\0' char num[3] = {"00"; char ext[5][".txt"}; int fnumber; then use a for loop, …

Member Avatar for vinitmittal2008
0
152
Member Avatar for fussballer

You don't seem to have the malloc or the passing array part of the logic, just right. Post enough of the code that we can get an example that is meaningful to correct for you. Those errors have to be studied - post them up with your expanded example. Minimum …

Member Avatar for mitrmkar
0
244
Member Avatar for fussballer

Without seeing the code, it's hard to make decent suggestions on how to optimize it. Can you post it, and be more detailed about the +/- error that is acceptable? I'm not clear about what has you stumped either, about creating a look up table. It's a 2D array (frequently). …

Member Avatar for Adak
0
238
Member Avatar for manga127

You could google Microsoft Visual C/C++ Express (it's free), and also, download the video tutorial that shows how to use it (also free). By default, programs with the dot cpp extension are handled by the C++ compiler, and files with the dot c extension, are handled by the C compiler. …

Member Avatar for manga127
0
276
Member Avatar for challarao

Turn it over 90 degrees, and see the columns as rows, and the rows as column. memcpy helps a lot. ;) [CODE] #include <stdio.h> #define R 4 #define C 5 int main() { int i,j, r, c,n; int grid[R][C]={ {0,0,3,4,5}, {0,3,2,1,6}, {0,0,0,2,0}, {6,2,0,3,1}, }; int temp[R]; printf("\n\n\n"); for(r=0;r<R;r++) { for(c=0;c<C;c++) …

Member Avatar for Adak
0
178
Member Avatar for rohit_static

This is what I've used for Shell sort: [CODE] //Shell sort void shellsort(int A[]) { int i, j, gap, temp; for(gap = MAX/2; gap > 0; gap /= 2) { for(i = gap; i < MAX; i++) { for(j = i - gap; j >= 0; j -= gap) { …

Member Avatar for Adak
0
191
Member Avatar for rinjin07

Check out "Brainphuck" language, on Wikipedia. (with an 'f') ;) It messes with you, but it's not English, for sure. ;) They mention others, as well.

Member Avatar for darkbreaker
0
105
Member Avatar for steve_Student

If you had a discount array, where every day was represented by the number of the row, and every column represented the hour of the day: [CODE]Sunday (row 0): 0 (midnight) 1 (0100) 2 (0200) 3 (0300), etc. Monday (row 1): 0 1 2 3 [/CODE] Then each element could …

Member Avatar for steve_Student
0
189

The End.