473,511 Members | 16,849 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Read an Array from an External File

2 New Member
Hello ,
How can I read an array of integers from an external file ? Each array is in one line and i don-t know the number of integers.I don`t want to use a string of chars, I need them as integers to be able to sort them further.
Please help me if you could
Thanks
Oct 10 '06 #1
1 2819
Banfa
9,065 Recognized Expert Moderator Expert
read them as an array of characters first anyway using fgets (it is the safest way)

Then use the function

long strtol ( const char * string, char** endptr, int radix );

To convert you array of characters to an array of integers (by calling it repeatedly)
Oct 10 '06 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

6
1750
by: ku_coyote | last post by:
I have an external file, TestVar.js with a single line. NewsA("This is a test.","test.pdf","TEST") Within my HTML I wish to use the array variables from TestVar.js, but can't seem to get them...
3
5493
by: Mark Dunmill | last post by:
I can't create a Constant/Read-only array field in managed C++ classes - doesn't allow the keyword const pointer to const object on array fields in managed C++ classes. e.g. Want to define a...
0
3220
by: jim4u | last post by:
I am porting a vb library to vb.net. The vb library has an external call to an unmanaged dll. Existing code: //External function declaration Private Declare Function Uncompress& Lib...
0
1725
by: jim4u | last post by:
I am porting a vb library to vb.net. The vb library has an external call to an unmanaged dll. Existing code: //External function declaration Private Declare Function Uncompress& Lib...
13
1918
by: Salvatore Di Fazio | last post by:
Hi, I've an array in an include that is used everywhere in the project. So to avoid the problem of declaration I made the following solution: ifndef __UNWALKABLETILES__ #define...
9
9386
by: joshc | last post by:
Hi, I have an array defined in one file with an intializer as follows: int arr = {0, 1, 2, 3}; I have a declaration of the array in another file as follows: extern int arr;
4
2369
by: teddarr | last post by:
Here's my quandry.....I am building a phone book program with student and staff classes. In main() I am to define 2 arrays 1 for students and 1 for staff. Each array will hold objects. I have...
3
4218
by: gsuns82 | last post by:
HI all, I tried to read an array from an external javascript file called read.js,The array was declared & as well as defined with some values inside the <script> tag of a html file. For an...
2
9129
by: saritha2008 | last post by:
Hi, As part of transforming one form of xml to another form, i need to do the below mentioned transformation: My Input XML: <rss> <channel> <item> <assignee...
0
7242
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
7355
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,...
0
7423
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7510
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5066
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4737
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3225
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3213
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
781
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.