0 registered members (),
16,302
guests, and 5
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: Help me please,how to find strings using file_find?
[Re: Sergmodern]
#313738
03/03/10 10:09
03/03/10 10:09
|
Joined: Mar 2010
Posts: 26
Sergmodern
OP
Newbie
|
OP
Newbie
Joined: Mar 2010
Posts: 26
|
I have the database fields are: product code, name, model, price, manufacturer, date of receipt at the warehouse, the first to write a search function for its product code, here is my code, which does not come out:
function search_tov()
{
var temp,FoundIt,Posi,i;
inkey_active=0;str_cpy(mulkod," ");inkey(mulkod);//str_cat(mulkod," "); //Ââîä êîäà òîâàðà
fhandle = file_open_read("Tovar.dll");
// FoundIt *= false;
// while (Posi+1<=file_find(fhandle,mulkod) && !FoundIt)
// {
// file_seek(fhandle,Posi,0);
// //file_str_read(fhandle,mul2);
// FoundIt*=(mul2=mulkod);
// if (!FoundIt) Posi=Posi+1;
// }
//file_str_read( fhandle, (find_kod.pstring)[i] );
//for(i=0; i<j; i++)
//{
// //txt_for_dir(sh_tov,mul2);
// file_find(fhandle,mulkod);
// file_str_read(fhandle,mul2);
// if (mulkod=mul2)
// file_str_read( fhandle,(find_kod.pstring)[i] );
// }
FoundIt=0;
while(i<=j)
{
file_str_read(fhandle,mulkod);
file_find(fhandle,mul2); //mul2 it's a code of product in the programm.
if (mulkod=i) file_str_read( fhandle,(find_kod.pstring)[i] );
i=i+1;
}
file_close(fhandle);
}
|
|
|
Re: Help me please,how to find strings using file_find?
[Re: Sergmodern]
#313739
03/03/10 10:25
03/03/10 10:25
|
Joined: Mar 2010
Posts: 26
Sergmodern
OP
Newbie
|
OP
Newbie
Joined: Mar 2010
Posts: 26
|
Function main()
{
inkey _ active = 0; str _ cpy (mul, ""); inkey (mul); str _ cat (mul, ""); / / Enter the name of the goods
inkey _ active = 0; str _ cpy (mul 1, ""); inkey (mul 1); str _ cat (mul 1, "") / / Input model
inkey _ active = 0; str _ cpy (mul 2, ""); inkey (mul 2); str _ cat (mul 2, "") / / Enter product code
inkey _ active = 0; str _ cpy (mul 3, ""); inkey (mul 3); / / Entry date
inkey _ active = 0; str _ cpy (mul 4, ""); inkey (mul 4), / / Input value
inkey _ active = 0; str _ cpy (mul 5, ""); inkey (mul 5); / / Enter manufacturer
str _ cpy (mul 6, mul); / / copying a string which displays the data on this product
filehandle = file _ open _ append ( "T ovar. dll");
file _ asc _ write (filehandle, 1 3); / / Write to file products
file _ asc _ write (filehandle, 1 0);
file _ str _ write (filehandle, mul 6);
file _ str _ write (filehandle, mul 1); / / Write to file stylists
file _ str _ write (filehandle, mul 2); / / Write to file Article
f i l e _ c l o s e (f i l e h a n d l e);
set (endvvtov, SHOW); / / put all the necessary information about product
fhandle = file _ open _ read ( "T ovar. dll"); / / reading from file
file _ str _ read (fhandle, mul 6);
f i l e _ c l o s e (f h a n d l e);
/ / Set (naimenov, SHOW); / / Output information about product
search_tov();
}
|
|
|
Re: Help me please,how to find strings using file_find?
[Re: Sergmodern]
#314266
03/07/10 11:18
03/07/10 11:18
|
Joined: Sep 2009
Posts: 1,032 Budapest
Aku_Aku
Serious User
|
Serious User
Joined: Sep 2009
Posts: 1,032
Budapest
|
Hey i don't understand what is your problem. Moreover your code is mysterious for me. But when overview this post something catched my eyes.
filehandle = file _ open _ append ( "T ovar. dll");
I advise to you, don't use SPACES in filenames. Good luck.
Last edited by Aku_Aku; 03/07/10 11:18. Reason: a missing i letter
|
|
|
Re: Help me please,how to find strings using file_find?
[Re: Aku_Aku]
#314382
03/08/10 08:33
03/08/10 08:33
|
Joined: Mar 2010
Posts: 26
Sergmodern
OP
Newbie
|
OP
Newbie
Joined: Mar 2010
Posts: 26
|
AHA=) No I do not use spaces in file names, I just dragged this code in the document word, and therefore turned out spaces in file names. I have already written code search product on its code in the database, that look like works.
function search_tov() { var temp; fhandle = file_open_read("strings1.dll"); // файл содержит: j j=file_var_read(fhandle); // теперь j file_close(fhandle); fhandle = file_open_read("Tovar.dll"); // test.txt содержит "this,was,a,test" inkey_active=0;inkey(mul); temp = file_find(fhandle,mul); if (temp<0) str_cpy(ac,"Строка не найдена"); else str_cpy(ac,"Найдена строка:"); for(i=0;i<j;i++) { file_str_read( fhandle, acc); break; wait(1); } file_close(fhandle); delete_tov(); }
|
|
|
Re: Help me please,how to find strings using file_find?
[Re: Sergmodern]
#314496
03/08/10 21:56
03/08/10 21:56
|
Joined: Sep 2009
Posts: 1,032 Budapest
Aku_Aku
Serious User
|
Serious User
Joined: Sep 2009
Posts: 1,032
Budapest
|
As i know there is a MySQL plugin for 3D GS. MySQL plugin by Joozey Perhaps there are more, you can search for them freely. Addendum: There isn't any delete instruction for erase one line from a file.
Last edited by Aku_Aku; 03/08/10 21:58. Reason: the addendum
|
|
|
|