Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Apparently Dani agreed with the OP:

Mobile Dev forum

Have fun.

Well then I think she needs to add a new forum for MS-Windows like I asked (and was rejected/ignored) over two years ago. There are hundreds of posts in the C and C++ forum that ask questions about win32 api.

jonsca commented: I'm for that! +0
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You have to add the main() function that includes all the code that does the things you stated in your questions.

Will I write it for you? NO. You will learn nothing if I do that.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

If you are using either VC++ 2008 or 2010 then to go menu item Project --> Propertiess (last item in the list), expand the Configuration Properties tab, General, then on the right side of the screen, third item from bottm change Character Set to Not Set AFAIK that's the only way to do it. I wish Microsoft had set an option in Options to make that the default.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

That error message means you compiled the program for UNICODE. You can do that, but you have to change strings to unicode strings. There are several ways to do it, but IMHO the best way is to use the _TEXT() macro, for example ofn.lpstrFilter = _TEXT("All\0*.*\0Text\0*.TXT\0"); Doing that the program will compile correctly whether or not the program is compiled for UNICODE.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Just logged on after 24 hours.
1) I liked the revised buttons that are now clickable. That's a good improvement

2) Don't like the way the badges were implemented. Although they are usable they are not as nice looking as in the previous version of DaniWeb. In previous versions it was immediately obvious who the mods were -- that is more obscure now unless of course you know who they are anyway.

I don't like the way the badge popup is shown whenever the mouse hovers on any part of the user name column, such as it pops up even when you put the mouse on the Edit/Delete button. IMO it should only pop up when the mouse is over the avatar or user name.

3) The "Edit/Delete" button still has not been changed to just "Edit". It does no harm to leave it, but its such a simple change that should take someone only a few seconds to fix.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

First, do no use two different loops to calculate the minimum and maximum values -- do that all in the same loop. When the program gets to that second loop to calculate the minimum value the file pointer is already at end-of-file so the loop don't do anything. Just combine both loops by putting the if statement in the second loop after the if statement in the first loop. Don't forget to move the other two lines as well into the first loop.

Other than that, I don't see offhand what caused the seg fault.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>can u rewrite the code...
Yes I can -- but I won't. You will never learn how to write programs if other people do your work for you. Post your attempts to solve it then ask questions. I already gave you a couple hints.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Probably because that code prints the EOF character. Try this one. Variable C needs to be int, not char.

int c;
while( (c = getchar()) != EOF)
   putchar(c);
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

1) I like the new ribbon at the bottom that contains MFF Today's Posts etc. Problem is once you click on MFF there is no way to remove the popup menu.

2) I liked the old color scheme better than this purple -- but we'll get used to this one.

3) I don't like that Popularity column -- seems redundent with the Reply count immediately next to it. The real estate for that column could be better used for something else.

4)I see both rep squares and post count stars are both gone. Looks better that way.

5)Clicking the New button used to take me to the first new post that followed the last one I made. It currently does nothing. I liked that feature and used it a lot. Hope you will restore it.

6) Hidden Quotes -- nice feature.

7) What is Permalink ???

lllllIllIlllI commented: I liked that button tooo :( +0
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Yes you are right -- I had the 25 and 80 turned around. But the same problem still occurs. Take the first string "Terminal". Your program will copy that string starting in the 10th position of Table[0], e.g. Table[0][10]. What do you intend to do with the first 10 characters of that row?

>>and any spaces in between them
There are no spaces between them because you didn't put any there.

To answer your specific original question, you have to pass addresses to strc py() strcpy(&Table[0][i],szLocations[y]); -- Note the use of the & address operator before Table.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

most likely the problem is line 66. The value of variable a may exceed the number of rows in the array script. Count the rows in that array -- there are only 5. But the value of a can be as much as 9. Most likely the same problem with all those other variables.

Salem commented: An obvious truth that has yet to be recognised by the OP +20
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

yeah, seems like everything gives five points.

tell me something that doesnt give five points.

The point system is stated in the Rules. Suggest you read them.

jephthah commented: lulz. got me. +0
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

What, then constitutes .NET?

Read this wiki article

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Spend a year or two learning C and/or C++ and you will be able to write that program yourself. Otherwise, deposite $10,000USD in my PayPal account and I'll write it for you -- someday.

The program specs you posted do not say what you want the C program to do -- only what MS-Access file to use. What exactly is it the program is supposed to do with that file ?

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>how can i update a text file i,e only one particular record in a file

The only way to do that is to completly rewrite the text file, making whatever changes you want while doing that.

Salem commented: Yes +20
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Post your teacher's email address and the course number of the class you are taking so that we can e-mail the program to him/her.

Fbody commented: LOL :) +1
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

The first place to start is to improve the program's formatting. Writing the code with everyting starting on the left margin is not only ugly but very difficult to read. You might get more responses by improving the program's formatting.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

for(;;) is just one way to create an infinite loop. Another way is while(true) or while(1)

After cin >> choice; you might want to add a series of if statements or a switch statement and a series of cases.

cin >> choice;
if( choice == '4')
   break;
else if( choice == '1')
   do_something();
else if( choice == '2')
   do_something_else();

The break statement where you have it will cause the infinite loop to exit regardless of the value of choice.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>Now if I input 32432, 23432, 23234, 1233,9898, 87343, 238432

gets() is a horrible function because if the input buffer is not large enough to hold all the characters you type then it will just scribble any excess characters all over memory. So if you typed that all on one line before hitting the <Enter> key then gets() will crash your program. gets() doesn't stop at the first spaces, but only when '\n' is encountered.

A better way to do it is to use fgets(), which will limit the input to the size of the input buffer. The problem with fgets() is that it may put the '\n' in the buffer too, which you will have to remove. fgets(stn, sizeof(stn), stdin); [edit]gerard ^^^ posted the correct example.[/edit]

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

lines 10 and 14: Attempting to call strlen() with an array of integers instead of a character array. See the parameter to that function. You might want to add another parameter to that function that is the number of entries in the array. void encrypt(int b[50], int size)

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

from what I seen in this link that is a file produced by Visual FoxPro. So the easiest way to do what you want is to buy a copy of VFP and let it export the data to a text file.

Also read this link

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Or it might be every American is a gun-tote'n gunslinger.

jephthah commented: i think that's more like some americans' stereotype of themselves. the reality is less cowboy, and more gangbangers and rednecks. +0
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Yes I agree code snippets is a joke. Why? Because most of those posted in the past few months are not code snippets at all but just questions in which the op erroneously selected code snippet. Then the mods have to go in and correct those posts.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You can view the comments of the rep you have been given by looking in your CONTROL PANEL (see the link at the top of every DaniWeb page)

You could also do it your way, but press your browser's Back button or just clicking anywhere outside the rep box when you are finished reading the comments.

VernonDozier commented: Here's some "rep". It won't count, but thanks. +0
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You need to declare it like this: char src[100]="eretznehederet"; so that variable src is not a pointer into read-only memory. you can change the 100 to anything you want, as long as its large enough to hold all the text you want to put into it.

Next, at the end of that split function use strcpy() to copy the contents of temp back into src. strcpy(src,temp);

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

The macro NULL is intended for pointers, not integers, Instead of casting NULL to int why not just pass 0? It would make more sense. Example: line 11 should be like this: if ( numOfArrays == 0 && sizeOfEachArray == 0) Remember: integers are not pointers (normally) so using NULL for them is an inappropriate use of that macro.

>>I can't free stringArray2 from main
why not?

>> makeString ( (int)NULL, (int)NULL );
The string can not be free'ed that way. Make another function to free the array void FreeString(char **string, const int numOfArrays, const int sizeOfEachArray )

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I think you are a little confused about how to do file i/o. First you have to open the file, next check if the file open succeeded, and finally read the file

in_stream.open("itemlist.txt", ios::in);
if( !in_stream.is_open() )
{
   cout << "Error opening the file\n";
   return 1;
}
// now you are ready to read the file
// read each item in the file
while( in_stream >> itemnum >> price)
{
   // blabla
}
Salem commented: Nice, but I fear the situation is a hopeless case. +20
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

open the file in binary mode then read it 128 bytes at a time

FILE* fp = fopen(arg[2],"rb");
char buf[128];
size_t nBytesRead;
while( (nBytesRead = fread(buf, 1, sizeof(buf), fp)) > 0)
{

}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

The value of A is 60, yet you have a loop that assumes its 600. Change that loop like this: for(i=0;i<A;i++)

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You have to reset the value of size on each loop iteration

void Registry::enum_key()
{
	int i = 0;
	while( RegEnumKeyEx(hkey , i , name , &size , 0 , 0 , 0 , &filetime) != ERROR_NO_MORE_ITEMS)
	{
		cout << i << ":" << name << endl;
		i++;
		size = sizeof(name);

	}
}
vbx_wx commented: true helper +1
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I've worked with MFC pretty extensively, and I can say for certain that it's at times a pain in the ass. I have not worked with it since VC++ 2005. If you're just getting started with GUI then I'd suggest you learn a more portable GUI package which works with several different platforms. wxWidgets is one, and QT is another. If you want 2d modeling such as for games then try out OpenGL. All of these require a firrm understanding of C and C++.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Writing binary file would be more efficient, but unreadable with any standard text editor such as Notepad. Note that file_out has to be opened in binary mode.

file_out.write( (char *) atoms, sizeof( atoms));
file_out.write( (char *)&origin_x, sizeof(origin_x));
file_out.write( (char *)&origin_y, sizeof(origin_y));
file_out.write( (char *)&origin_z, sizeof(origin_z));

Then to read it back, just replace write() with read()

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Create an array of pointers, then read each line and add to the array

char *data[200]; // 200 lines of data
char line[255]; // one line from the data file
fgets(line, sizeof(line), fin);
data[0] = malloc( strlen(line) +1);
strcpy(data[0], line);

Now put the above in a loop so that it reads the entire file. Increase the array size if needed so that it will hold all the lines in the file.

Aia commented: Nonsense -2
adrawat commented: Amazing answer !!! +1
Nick Evan commented: If the OP is happy, I call it a good enough post. +12
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>There is a yearly membership fee of $500.00 and a monthly usage fee of $3500.00.

I would attend a different fitness club. Gold Gym only charges about $35.00/month. And the last time I checked the YMCA was $45.00/month. Why would I want to spend $3,500.00/month for that crappy health club? Do I get free drugs or sex too?

jonsca commented: Mega LOL +4
jephthah commented: aha :) +7
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I already told you that fin is just the name of a variable. Change it ao anything (almost) that you want.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

So just add the full path to the filename.

str = "C:\\user\\user\\Desktop\\history\\" + str;
str += ".txt";
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>.Sorry AD, but you are missing the point here,

Yes, you are right. What I posted was crap.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Thank you though, but i dont want all of it, i just do get how i put the array and the loop to get to work together.
Thank you :D

First create an array, such as int myarray[10]; . Open a file and read data into each element of the array. Something like this: but your requirements may be a little different, I don't know because I didn't bother to read all that stuff.

int myarray[10];
ifstream in("filename.txt");
for(int i = 0; i < 10 && in >> myarray[i]; i++ )
   ;
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I need your help AT ONCE plz IN C CODE ONLY

Go get stuffed. I wouldn't help you now even if I wanted to just because of your crappy attitude.

jephthah commented: damn skippy! +7
thomas_naveen commented: :-) +1
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

How are we supposed to search for something in code snippets? I tried Site Search, selected C++ Snippets but got results in all the forums EXCEPT code snippets :icon_eek: That makes the Site Search almost unusable when searching for key words in specific forums.

And using DaniWeb Code Snippets link under Related Forum Features is nearly as useless. There should be a way to resort them alphabetically by subject or by author.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Your terminology sucks -- its "reading the data file", not "importing" it. Your program is reading the data file all wrong. google for and read tutorial about "c++ file i/o".

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

we've (the students) have already worked on compiler and interpreter design prior to this, which I haven't yet. So with that knowledge there is a chance I may need to drop the class because of this

I'm surprised your university even let you register for that class without the prerequisits.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

if(((int)str[count]>=65 && (int)str[count]<=90) || ((int)str[count]>=97 && (int)str[count]<=122))

it would make more sense like this so that you don't have to think about what the decimal values for 'A' and 'a' are. You are trying to find out if the character is A-Z or a-z, not 65-90.

if( (str[count]>='A' && str[count]<='Z') || (str[count]>='a' && str[count]<='z') )

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Nice work :) Its just as unsafe as the original.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

If you want spaces in the name then you will have to use getline(), not the >> operator.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

If the compiler will generate the proper machine codes and the linker will produce the proper addresses then yes it will produce executable code....The only remaining obstacle is wrapping the executable code in a format recognized by the operating system...

Isn't that the job of the linker?

The program doesn't have to be compiled on the target operating system. There are cross-compilers which run on one os but compiles and links code for another os. I know of at least one os where there are no C compilers available, so the programmer's only choice is to write assembly code.