473,386 Members | 1,791 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

i want help on FILE IO

hi
i hv stored 32 HEX numbers in a file and i want to load it into int
arr[32].
i hv tried so but i cant.
how can i do it ?
Please help...!

Jul 29 '06 #1
3 1096
Ico
me*********@yahoo.com <me*********@yahoo.comwrote:
hi
i hv stored 32 HEX numbers in a file and i want to load it into int
arr[32].
i hv tried so but i cant.
how can i do it ?
Show us the code of what you tried so far so we can give you some tips
and comments on what is wrong with your program.

--
:wq
^X^Cy^K^X^C^C^C^C
Jul 29 '06 #2
me*********@yahoo.com said:
hi
i hv stored 32 HEX numbers in a file and i want to load it into int
arr[32].
There is no such thing as a hex number. Presumably you mean you've stored
the hexadecimal representations of 32 numbers. And now you want to convert
them back into numbers. That's easy enough. Just open the file, read in
each representation in turn, and pass it to strtoul, specifying 16 as the
third argument (the base specifier). Store the result in arr[i].

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at above domain (but drop the www, obviously)
Jul 29 '06 #3

"Richard Heathfield" <in*****@invalid.invalidwrote in message
news:d9********************@bt.com...
me*********@yahoo.com said:
>hi
i hv stored 32 HEX numbers in a file and i want to load it into int
arr[32].

There is no such thing as a hex number.
But there are numbers with hexes on them. Like these.
>
Presumably you mean you've stored
the hexadecimal representations of 32 numbers. And now you want to convert
them back into numbers. That's easy enough. Just open the file, read in
each representation in turn, and pass it to strtoul, specifying 16 as the
third argument (the base specifier). Store the result in arr[i].
I suspect that the numbers have been stored in binary format. They could be
16 or 32 bit, little or big endian. So it is bit of a messy job to load them
portably, but it can be done.

To the OP, give us a hex (not hexed) dump of the file, with a list of the
values the numbers should take if you have them, an idea of the range if you
don;t have the numbers.
--
www.personal.leeds.ac.uk/~bgy1mm
freeware games to download.

Jul 29 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: SL_McManus | last post by:
Hi All; I am fairly new to Perl. I have a file with close to 3000 lines that I would like to split out in a certain way. I would like to put the record type starting in column 1 for 2 spaces,...
2
by: Jon Glazer | last post by:
When doing a getfolder() I want the first file in the resulting FILES collection. I don't want to do a for/next cuz the list may be very long. Just the first file is all. How do I do this? Doin...
4
by: veereshai | last post by:
i want to copy the functions from my source file into a new file...and convert each function into a new object file by compiling it. now, i want to invoke the function using the object file i have...
2
by: Bassem | last post by:
Hi Everyone. Thanks for Help. Simply I want to create a file saved in it information but in the same time when anyone try to read this information couldn't understand the contents of the file....
0
by: darren | last post by:
When using the html input file (input type=file), is there anyway to NOT have the file loaded on the server? I am only interested in using this control to browse to a file and then get the filename,...
3
by: jhanzl | last post by:
All - I am looking into a way of uploading just the first portion of a large (> 100M) .csv (text) file to the server. Ultimately what I want to do is read the first line of the .csv file, which...
4
by: kevin | last post by:
Hi, I am trying to create a page so the user can browse the network, select a file and have that file name (text) inserted into our sql DB so I can build the hyperlink path later on. Here's what...
6
by: Champika Nirosh | last post by:
Hi, I have two machine where I needed to have a extended TCP/IP protocol to make the link between the two machines Mean,I need to write a application that compress every data the machine send...
5
by: Ron | last post by:
I've got some C# code that sort of does what I want: Looking at the xml files in area: http://www.keepitsimplekid.com/xml I want to change Untitled Ad at the top of the xml to the name of the...
4
by: Alan Mailer | last post by:
Again, I'm new to VB.net and there is something I need help with: Like (I assume) many of us, over time I want to be able to create some VB.net classes that I might want to use in more than one...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.