dear sir...
i got a confusing of this...

ifstream is;
			Char c, temp_isi_file[100];			
			int i;
		    is.open ("b.a");
			memset(temp_isi_file,'\0',100);
			while (is.good())     // loop while extraction from file is possible
			{
				c = is.get();
				if (is.good())
					if (c==',')
				    {
						//cout << temp_isi_file << ":" ;	

						textBox1->Text = Convert::ToString(temp_isi_file);
						
						i=0;
						c='\0';
						memset(temp_isi_file,'\0',100);
					}
					else
					{
						temp_isi_file[i]=c;
						i++;
					}
			}
label2->Text = Convert::ToString(temp_isi_file);

when I, show temp_isi_file to textbox,, the value is true. but I think, it should be the content of my file b.a. So, I don't know how to get the value "temp_isi_file"???
And then, I wanna convert the value "temp_isi_file" to binary. did I true to convert the file by convert it per temp_isi_file??

b.a
11111,33333,4444
temp_isi_file value, it should be 11111 and then 33333, 4444.

thanks before...

Instead of reading the file one character at a time, why not use getline() to read the entire line?

while( ls.getline( temp_isi_file, sizeof(temp_isi_file), ',') )
{
     // now temp_isi_file only contains one integer
     int n = atoi(temp_isi_file);

    // or if you prefer c++
    stringstream str(temp_isi_file);
    int n;
    str >> n;
}

dear sir,,
if I use this,,

while( ls.getline( temp_isi_file, sizeof(temp_isi_file), ',') )
{
     // now temp_isi_file only contains one integer
     int n = atoi(temp_isi_file);

    // or if you prefer c++
    stringstream str(temp_isi_file);
    int n;
    str >> n;
}

I, should be difficult of formatting the type of my data. because,, my file's content.. don't have one data type only. not for integer only but string, char, etc. if I use my code.. is there the way I got the value??

thanks..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.