No one has voted on any posts yet. Votes from other community members are used to determine a member's reputation amongst their peers.
Hi there, I'm writing some application based on Qt and C++ and I've reached the problem. How to display window via clicking, triggering, etc. I wrote some code: //---------------------------- // THIS IS IN mainwindow.h //---------------------------- #ifndef MAINWINDOW_H #define MAINWINDOW_H #include <QMainWindow> namespace Ui { class MainWindow; } class MainWindow : … |
|
Hello. I have some problems with recieving text from ListBoxItem. My code is below: ListBox list = (ListBox)this.FindName(e.Parameter.ToString()); ListBoxItem item = (ListBoxItem)list.Items.GetItemAt(0); //****here is exception**** T.Text = item.Content.ToString(); list.Items.RemoveAt(0); The exception throws: Unable to cast object of type 'System.String' to type 'System.Windows.Controls.ListBoxItem'. My ListBox contains numbers, but it does not … |
|
Hello. Everything I have to do is just changing some specific text from first file to another text. I have a clue - read first file character by character to array while character != space. After that compare array with my replacement text and decide what action will be performed. … |
|
Hi everyone, I wrote something like that: [CODE] book *library = NULL; customer *service = NULL; do { printf("**********MENU***********\n"); printf("* #1 List of books *\n"); printf("* #2 Add book *\n"); printf("* #3 Search by title *\n"); printf("* #4 Search by category *\n"); printf("* #5 Search by author *\n"); printf("* #6 … |
|
Hello. I'm writing Windows Form App and I found "tiny" trouble. I can't manage with finding control by a name. I have this code: [CODE]private Control FindByName(string name) { foreach (Control c in this.Controls) { if (c.Name == name) return c; } return null; }[/CODE] and simply it doesn't return … |
|
Hello, I have a list of strings. It contains strings with NAMES of my objects. This mean: [CODE]First f1 = new First(); Sec f2 = new Sec(); Third f3 = new Third();[/CODE] And my list contain: [CODE] List<string> smth = new List<string>(); First, Sec, Third[/CODE] How can I create object … |
|
[CODE] //file included from main.cpp #include <iostream> #include <ctime> void generate(int height, int width) { int i,j,random,x,y,check; char map[height][width]; bool way[4], border[3]; srand(time(NULL)); //[error 'srand' was not declared in this scope] for(i=0; i<height; i++) { for(j=0; j<width; j++) map[i][j] = 178; } x = rand()%height; //[error: 'rand' was not declared … |
|
My array $pids contains integers. For example: 18742 59274 94255 97124 18742 94255 94255 I wrote: [CODE]$pid = array_unique($pids); for($i=0; $i<count($pid); $i++) echo $i.' '.$pid[$i].'<br />';[/CODE] And the output is: 0 18742 1 2 3 What's wrong? Why array_unique() doesn't throw away duplicated values? |
|
Hi. I have a troubble with reading string from file and saving it in a structure. Here's my code: [CODE] FILE*t; t=fopen("file.txt", "r"); wt=(pointer)malloc(sizeof(list)); w=wt; for(i=0; i<3; ++i) { w=(pointer)malloc(sizeof(list)); fscanf(t, "%d", &w->id_t); fscanf(t, "%s", &w->name); fscanf(t, "%f", &w->price); fscanf(t, "%d", &w->tax); printf("%d\n", w->name); //for check w->next=NULL; fscanf(t, "%c", &c); … |
|
I have a problem. I wrote: [CODE] for(i=0; i<n; i++) { m++; char **exP = realloc(exParam, m*sizeof(*exParam)); char **exT = realloc(exText, m*sizeof(*exText)); exParam = exP; exText = exT; explode = strtok(lines[i], "#"); while(explode != NULL) { exParam[m-1] = malloc(strlen(explode+1)); strcpy(exParam[m-1], lines[i]); exText[m-1] = malloc(strlen(explode+1)); strcpy(exText[m-1], explode); explode = strtok(NULL, "#"); … |
|
I have to read text file line by line to multidimensional array. I have this code: [CODE] char *data; data = (char*)malloc(size_d); while(fgets(data, size_d, fp) != NULL) { printf("[%d] %s ", strlen(data), data); } [/CODE] I want to put every line to char array. Some suggestions? |