LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

double number to string

Robert i used function filetoarray to convert a file like this

12.23547

14.777777777

1.3325

222.368

12.3235

robert i used then arraytofile function to write these values in file.

sir is there any way when i use filetoarray function i pick ist values from above file in array.

or similearly i pick last 3 values in array?

actualy i have to pick data from different files and write in to one file at specific positions. from one file i have to write ist 4 values at diffenent position and last 4 on different.

0 Kudos
Message 11 of 25
(2,317 Views)

i used read a line function alright and done my task with that also. but i dnt know how to bring my pointer on back after endoffile

 

0 Kudos
Message 12 of 25
(2,319 Views)

khadimhussain ha scritto:

Robert i used function filetoarray to convert a file like this

12.23547

14.777777777

1.3325

222.368

12.3235

robert i used then arraytofile function to write these values in file.

sir is there any way when i use filetoarray function i pick ist values from above file in array.

or similearly i pick last 3 values in array?

actualy i have to pick data from different files and write in to one file at specific positions. from one file i have to write ist 4 values at diffenent position and last 4 on different.



There is no way to customize FileToArray behaviour to operate as you want. Consider this function as an express way of reading a file, easy to use but rigid. If you need some more specialized task you must program it by yourself.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 13 of 25
(2,316 Views)

khadimhussain ha scritto:

i used read a line function alright and done my task with that also. but i dnt know how to bring my pointer on back after endoffile

 


Depending on the family of functions you use there is a specific file positioning function to use: fsetpos for ANSI C library functions, SetFilePtr for Formatting and I/O Library functions (which seems to be your case).



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 14 of 25
(2,317 Views)

If you don't care about speed to much just close the file and then reopen it. This is a quite a hack though.

 

Robert is correct to say use setfileptr (if used the NI function OpenFile and are working with an int file handle) or fsetpos (if you use AMSI C fopen and have ptr to FILE as a handle).

 

0 Kudos
Message 15 of 25
(2,299 Views)

hi i read the help of symbol asterik * but still dsnt understand properly. kindly give me some example code of fmt in which use asterik and explain me that code. i could understand uptill now that * will  be used instead of rep after % for example %*i but unable to use that comand i tried different things

for example i have

int array[8]={1,2,3,4,5,6,7,8};

 

Fmt (buf, "%s<%*i", array);

i could understand this but this is not working. what modifications i needed to convert array in to strings

 

 

0 Kudos
Message 16 of 25
(2,285 Views)

When you put an asterisk in the format string, a corresponding argument must exist in the argument list.

That is, the line should read: Fmt (buf, "%s <%*i", 8, array);



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 17 of 25
(2,281 Views)

You will need to Google "use of pointers in ANSI C code". You will need to practice and devote some trime to this concept in order  to do this correctly. Nobody can give you a one sentence answer to this. It is also really beyond the scope of a discussion forum.

0 Kudos
Message 18 of 25
(2,278 Views)

Roberto what will 8 do in that comand? i want to clear my concept means if i have array size 100 but i put only values up to 4th index than what value i will use at the place of 8.

0 Kudos
Message 19 of 25
(2,274 Views)

sir blanky i m working hard and i will read pointers but you guys are amazing and i feel so helpful to you all of them

 

0 Kudos
Message 20 of 25
(2,272 Views)