Jump to content

Check out our Community Blogs


Member Since 29 Jul 2009
Offline Last Active May 21 2017 04:37 PM

Posts I've Made

In Topic: Ask Me: Donovan

22 September 2011 - 06:58 PM


Why do you use the Maya Logo as your user avatar? Have you made something using Maya? Are you in to 3D modeling?

Have you tried learning a functional programming language, or do you already know [one|some]?

Do you have any exciting or new events going on in your life? You've been away for a while, would you like to update us?

I'll think of more later.

In Topic: fscanf for a certain amount of lines

22 September 2011 - 06:30 PM

for(k=0;k=N;k++) {
This will not work. Regardless of what you put in the for loop body, this will always result in an infinite loop unless you change the value of N or N is equal to 0. k=N does not check to see if k is equal to N, instead it assigns the value of N to k, and returning that value! You instead want to do this:
for(k=0;k<N;k++) {
Since the for loop will continue so long as the result of k<N is true.

In Topic: how to convert from char * to string?

19 September 2011 - 05:37 PM

@RhetoricalRuvim: Both of them work. I prefer [noparse][code=auto:0][/noparse] tags myself, along with any other tags I can use. The only real trouble I have with the quick reply window here is that it keeps the formatting of pasted text, which forces me to put it through a text editor first. -_-

In Topic: how to convert from char * to string?

19 September 2011 - 04:57 PM

You can simply use the (overloaded) assignment operator to assign a char * to a std::string. This will copy all the data over automatically.

If you're trying to copy from a std::string to a char *, the best way to do that is with strncpy(), but you have to get the char data from the string first!

size_t my_str_size_with_null_end = my_str->size() + 1;
  char *buffer = malloc(my_str_size_with_null_end);
  strncpy(buffer, my_str->c_str(), my_str_size_with_null_end);

In Topic: What is this Read Access violation Exception due to?

19 September 2011 - 05:44 AM

Determining based on the addresses themselves is NOT going to be easy, and what's more it looks like you're trying to compile/run a Java runtime, though that looks more like Microsoft code than Sun code.

What are you actually trying to do?

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download