Go Down

Topic: Search for a charactter in a file (Read 669 times) previous topic - next topic

pedro2012

please,
1)i want to konw if there is any function that Search for a certain character,nut without using the 'read' function

thank you 

jraskell

And where are you searching for this character?  our post title says 'in a file'.  Is this some file on an SD card?

Why exactly do you not want to use the 'read' function?  How else do you expect to read data from a file?

pedro2012

yes the file in Sd card,
the file will be very very long,and i don't want to spend a lot of time to read byte after byte
i'm writing every 10 s the temperature on the file
this file will be passed to an java sript evry time that there is some web request,when i recieve the request i need write in the end of the file ' ]' to close the function,
but once the web request finish ,i need to cancel the ']',and write th temperture

Grumpy_Mike

Even if there was a function to do this it would have to use the read function to acheave it.
There is no other way, something has to read every byte, that is how computers work.

jraskell

Quote
this file will be passed to an java sript evry time that there is some web request,when i recieve the request i need write in the end of the file ' ]' to close the function,
but once the web request finish ,i need to cancel the ']',and write th temperture


In that scenario, I would never write the ] to the file, but include it in the output to the java script.

pedro2012

do you know any function to do this?

Grumpy_Mike

Why it is only three lines at most if the file is open.

PeterH


when i recieve the request i need write in the end of the file ' ]' to close the function


I don't understand why you need to do that. Can you explain?
I only provide help via the forum - please do not contact me for private consultancy.

Go Up