thewonderdude 0 Newbie Poster

hi,

i have a question which feels like it should be very easy but my collegues have had some difficult explaining the logic to me.

The thing is,

I have a dropdown as such,

<ui:dropDown binding=..... tabIndex="5"/>

and in the jsp page, i want to set it to it's 10th element via javascript. So if the dropdown is showing element 1, when i press a button or key, it will show element 10. It doesnt have to interact with bean part. I just need to see the 10th element in the dropdown. I know the index and did something like this which felt odd and obviously didnt work.

document.forms[0]['form1:ddownid'].options.setAttribute(selected, 8)

Any suggestions are welcome,

Regards
Yigit

thewonderdude 0 Newbie Poster

Hi,

I'm quite bad in c++ and i have this weird (for me), problem that i can't work around.

#include <iostream>
#include <fstream>
#include <string>
using namespace std;
.....
int main(){
...
                int *array1=NULL;
		int *buffer=NULL;
		size=....;//a certain size comes from function
		array1= new int[size];// it looks like both array1 and buffer have only 1 element in them. 
		buffer= new int[size];//
...
                file_read(array1,false); //The crazy thing is, when i give static size to the arrays, i can see the array elements but when i send them through this function, the arrays appear on the other side as having 1 element.

This is the part of function where something is wrong.

int file_read(int a[], bool first)
....
		while(!myfile.eof())
   		{
  	 		myfile>> a[i];//the first and only element gets a value, other than that, i keeps increasing, the eof is never reached.
      			i++;
		}
...
thewonderdude 0 Newbie Poster

Glad to be of help :)

I still think there should be some function which gets number upto : then puts it in x, then reads on and gets the next up to : and puts it in to y, etc...

thewonderdude 0 Newbie Poster

Check out substr

http://www.cplusplus.com/reference/string/string/substr/

Well this seems to be working but i have to cheat to get the first number:)

Thank you

thewonderdude 0 Newbie Poster

cannot convert parameter 1 from const char* to char*

Is there some other way where i can read the info from a file and tokenize each line to 3 different values. In java it is deadly simple but i dont understand why its such a burden in c++

thewonderdude 0 Newbie Poster

cannot convert parameter 1 from const char* to char*

thewonderdude 0 Newbie Poster

Why not use strtok function to split each row, using ' : ' as separator?
http://www.cplusplus.com/reference/clibrary/cstring/strtok/

Well, there seems to be something wrong.

it gives error here

void reader()
{
	string holdInput ="";
	char *tokenizedInput;
	input.open("C:/Users/Yigit/Desktop/emre/input.txt");
	if(input.is_open())
		cout<<" opened succesfully"<<endl;
	else
		cout<<" epic fail"<<endl;
	
	while (! input.eof() )
               {
                  getline (input,holdInput);
	}
	tokenizedInput = strtok (holdInput," :");
input.close();
	
}

Do i have to do something after tokenizing to seperate the values.


As you may have noticed, i am relatively new to C++.
Thanks

thewonderdude 0 Newbie Poster

Hello,

I have to read from a .txt file which has info as such,

10:5:23
2:343:54
1:4:7 and so on.

3 Columns, lots of rows.

How can i read each column for example 10 to x, 5 to y, 23 to z.