[Solved] Process memory examination

pthread_t resources are not released. You should call pthread_detach or pthread_join, otherwise the pthread_t value remains valid consumes resources and I can guess that happens in this case. 0 solved Process memory examination

[Solved] C- Reading specific strings with quotes from a file

This should do the trick: #include <stdio.h> #include <string.h> int extract_line (char* line, char* buffer, char* ctag) { char line_buffer[255] = {0}; char* tagStart; char* tagEnd; if( strlen(line) < (sizeof(line_buffer)/sizeof(char)) ) { strcpy(line_buffer,line); } else { printf(“Line size is too big.\n”); return 1; } tagStart = strstr(line_buffer,ctag); if(tagStart != NULL) { tagEnd = strstr(tagStart+1,ctag); if(tagEnd … Read more

[Solved] In c++, what does an increment to a 2D array? Whats the function assert(0) doing? [closed]

Statement a[637][i]++ increases the value of the cell 637/i of two-dimensional array a. assert(0) simply aborts program execution at this point (since condition 0 means false, defining that the assertion is never met). Confer this SO answer for a more detailed explanation. solved In c++, what does an increment to a 2D array? Whats the … Read more

[Solved] A List from Property [closed]

Looking at your code the class Result is not a list which I think you are trying to call with List()? not sure.. To create a List<> you can do it multiple ways see below on a few options. Try these in your Main method. List<string> stringList = new List<string>(); //creates a List<string> called stringList … Read more

[Solved] N-Queens Algorithm using c++

The part in is_attaced in which you check the diagonals is not working. It has two basic problems, first you dont check all diagonals all rows – you just check the previous row. And, second, you are doing out of bound accesses, when you are in the first or last column. An implementation that is … Read more

[Solved] C# Multiple String Compare [closed]

If those strings are the same for all the cases – make them global: string a = “test”; string b = “try”; string c = “compare”; //case 1 for (int i = 1; i <= 2; i++) { if (a == b) { do something }; if (a == c) { do something}; } //case … Read more

[Solved] how to optimize repetitive addition

what you can is int j = 0,order[] = {0,7,3,4,6,1,5,2}; for(int i = 0;i <256; i +=2) { int x =add(array1[i],array2[order[j%8]]); j++; int y =add(array1[i+1],array2[order[j%8]]); j++; } UPDATE alternate solution can be (if you want without using i+=2) int j = 0,order[] = {0,7,3,4,6,1,5,2}; for(int i = 0;i <256; i ++) { int x =add(array1[i],array2[order[j%8]]); … Read more

[Solved] C# Split with contains

If you split first, you can use the first column as an Id column and search for exact match: string line; using (StreamReader file = new StreamReader(@”db.txt”)) { while ((line = file.ReadLine()) != null) { var values = line.Split(“,”); if (values[0] == “1713”) { label1.Text = values[2]; } } } 0 solved C# Split with … Read more

[Solved] How do i make a child game object affect the parent? [closed]

You should be able to add a collider to the child/head, BoxCollider2D for example. Then you can handle the Collision event and call a method on the parent object. It would look something like: // In the child/head void OnCollisionEnter2D(Collision2D col) { var goomba = transform.Parent.GetComponent<Goomba>(); goomba.Kill(); } This is probably the simplest way, but … Read more

[Solved] Find loop value inside string

This works. #include <string> #include <iostream> using namespace std; int main() { char title[20] = “testmovie2015.mkv”; int year=0,i=0; for(i=0;title[i]!=’\0′;i++){ if(isdigit(title[i])&&isdigit(title[i+1])&&isdigit(title[i+2])&&isdigit(title[i+3])) { year=1; break; } } if(year) { year=((title[i]-‘0’)*1000)+((title[i+1]-‘0’)*100)+((title[i+2]-‘0’)*10)+(title[i+3]-‘0’); if(year>=2000&&year<=2018) { int k=0; while(k<i) { cout<<title[k]; k++; } } else { cout<<“Year found: “<<year<<“, but out of given range”; } } else { cout<<“No year found … Read more