Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 112

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 112
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3368: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3370: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3371: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3372: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
OrbWorks Community Forum • View topic - dbwritex - written Data are not correct

dbwritex - written Data are not correct

Discuss PocketC for Palm OS (including Desktop Edition)

Postby JoergB on Sun Mar 07, 2004 8:30 am

I've write a small programm for testing the function "dbwritex".
When I use this programm with the function "dbwrite" all the written
data are correct.
The listing comprise german text. I hope this is not a problem to understand
the code.

The function "lesen()" have I leave out.

schreiben(){
puts ("DB-Inhalt wurde nicht gefunden wird jetzt neu erzeugt");

if (!dbcreate("Inhalt")){
puts("Fehler DB-Inhalt k?ɬ?nnte nicht erstellt werden");
}
else
dbcreate("Inhalt");
dbwritex(*zeiger1,'ccc');

}

main(){

char zahl1;
char zahl2;
char zahl3;

//Eingabe der Variablen
zahl1=gets("Eingabe Zahl1");
zahl2=gets("Eingabe Zahl2");
zahl3=gets("Eingabe Zahl3");


zeiger1=malloct(1,"3c");

zeiger1[0]=&zahl1;
zeiger1[1]=&zahl2;
zeiger1[2]=&zahl3;

title("dberzeugen");
clear();

puts("?ɬ?ffne DB-Inhalt");
if(dbopen("Inhalt"))
lesen();
else
schreiben();
}
}

Thanks
so long J?ɬ?rg
JoergB
 
Posts: 38
Joined: Tue Jun 12, 2001 5:38 pm

Postby JoergB on Mon Mar 08, 2004 8:56 pm

I have check the db function again .

this smal program write only zeiger1[0]='A';
zeiger1[1]='B'; but not zeiger1[2]='v';
in the memory.

I think this is a bug.
I have use PocketC version 6.5.1


main(){

pointer zeiger1 ;
int i;

zeiger1=malloct(1,"ccc");

title("dberzeugen");
clear();

dbcreate("Inhalt");

zeiger1[0]='A';
zeiger1[1]='B';
zeiger1[2]='v';

for (i=0;i<3;i++){
puts("i "+i+"\n");
dbwrite(*zeiger1[i]);
}
}

so long Joerg
JoergB
 
Posts: 38
Joined: Tue Jun 12, 2001 5:38 pm

Postby Mikael on Tue Mar 09, 2004 2:25 am

Does this do what you want?

//zeiger
main(){

pointer zeiger1 ;
int i;

zeiger1=malloct(1,"ccc");
zeiger1[0]='A';
zeiger1[1]='B';
zeiger1[2]='V';
title("dberzeugen");
clear();
dbcreate("Inhalt");
dbopen("Inhalt");
for (i=0;i<3;i++){
dbseek(i);
dbwrite(*zeiger1[i]);
puts("i "+i+"\n");
}
for (i=0;i<3;i++){
dbseek(i);
puts(dbread('c'));
puts("\n");
}
dbclose();
wait();
exit();
}

Mikael
Mikael
 
Posts: 156
Joined: Sun Apr 13, 2003 9:19 am
Location: Denmark

Postby JoergB on Tue Mar 09, 2004 6:33 pm

[quote]<i>Originally posted by Mikael</i>
<br />Does this do what you want?

No, I think you've not understand what I mean. I only want write 3 variables in a database. Normal a easy function. But what I see is with the testprogram thats only
too variables correct saved. I use the program RsrcEdit to check the datas in the memory. I've check it with many combinations.

Thanks
so long J?ɬ?rg
JoergB
 
Posts: 38
Joined: Tue Jun 12, 2001 5:38 pm

Postby lale on Wed Mar 10, 2004 8:17 am

Hallo Joerg,

You are stumbling across pointer arithmetics. If you use a
pointer as an array, you better not use the asterisk "*" along
with the squared brackets "[]" as you are already referring to
the value. Here is a working version of your code:
Code: Select all
main(){
pointer zeiger1 ;
int i;

zeiger1=malloct(1,"ccc");
title("dberzeugen");
clear();
dbcreate("Inhalt");
zeiger1[0]='A';
zeiger1[1]='B';
zeiger1[2]='v';

for (i=0;i<3;i++){
  puts(zeiger1[i]+"\n");
  dbwrite(zeiger1[i]);
}
dbclose();
}

Best wishes,

Lars

--
http://www.tiny-red-book.com
http://www.phenotyping.com
lale
 
Posts: 54
Joined: Mon Apr 23, 2001 10:56 am
Location: Germany

Postby JoergB on Wed Mar 10, 2004 12:06 pm

thanks for the reference , that was my problem :?.

so long
Joerg
JoergB
 
Posts: 38
Joined: Tue Jun 12, 2001 5:38 pm


Return to PocketC for Palm OS

Who is online

Users browsing this forum: No registered users and 3 guests

cron