Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Author
Message
B++
14
Years of Service
User Offline
Joined: 6th Dec 2009
Location: India
Posted: 2nd May 2010 13:40
Hi,
I want to save the following two values in a .txt file;

I did like this:

And then call the function:

Nothing is working. Can someone tell me how to do this?

Thank You


Your Signature Here;
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 2nd May 2010 13:55 Edited at: 2nd May 2010 14:23
You need to read about variable scope, how functions work and essentially when to use them. In my opinion, this is not one of those occasions.

See Number 6 Here

Or don't use functions. Your code should work perfectly as a subroutine - without the globals. Plus, you also have the ability to write data as strings.



You also appear to be misreading the help files (or making things up as you go along) which unfortunately doesn't work.:

write float 1,"me"

You should read a few tutorials so you know what you are doing...

See Number 4 Here

Quite a few of the tutorials in that thread will teach you a considerable amount.

TDK

B++
14
Years of Service
User Offline
Joined: 6th Dec 2009
Location: India
Posted: 2nd May 2010 14:06 Edited at: 2nd May 2010 14:08
TDK:
Srry TDK, I mistyped the code above. Srry my mistake. I was on my laptop while I posted this. But ya, the code is working now. I just added:

Anyway, thank you for your help. the code is working now.
Thank You


Your Signature Here;
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 2nd May 2010 14:35
Quote: "I just added: if file exist("something") then delete file "something"

Anyway, thank you for your help. the code is working now.
"


It can't be - not if that was the only typo and that's the only thing you changed!

Your global declaration was wrong and your Write Float and Write Long were both writing string literals.

As I said, that shouldn't really be a function and if it really has to be (which it doesn't), you don't appear to understand how functions work. Please check out those tutorials.

TDK

B++
14
Years of Service
User Offline
Joined: 6th Dec 2009
Location: India
Posted: 2nd May 2010 18:57
TDK:
Srry for misunderstanding. But I mean to say I mistyped:

I should have write;

Than I added;

After your reply I changed;

to

After those changes, it is working as expected.
And ya, I have checked the tutorials. Thank you for your guidance.

Regards


Your Signature Here;
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 2nd May 2010 22:52
OK - as long as you are now sorted - that's the main thing!

TDK

Login to post a reply

Server time is: 2024-11-23 16:46:24
Your offset time is: 2024-11-23 16:46:24