473,480 Members | 1,864 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Out putting 2d arrays to text files

1 New Member
i need an application that output a list of data to a text file. i have it set to save all of the data into arrays but it will not output the arrays to a .txt file. All i get is 0x22fed0 in the txt. How do i get it to output the entire array?
Oct 15 '06 #1
6 1864
Banfa
9,065 Recognized Expert Moderator Expert
Post your code
Oct 16 '06 #2
dtimes6
73 New Member
What u get is the address to the array. do iterate it using a for loop.
Oct 16 '06 #3
Starasoris
11 New Member
What u get is the address to the array. do iterate it using a for loop.
What type of data is the array. char? int? The array variable itself is nothing bat a pointer to that specified type.

int Slab[50]

Slab[20] = 100;
Slab[20] will give the value 100 and it is an integer

I will let you work the rest out.

I must admit that this has the feel of an unstudied university assignment about it.
There are far to many unqualified programmers with university degrees ;)

Study hard.
Oct 16 '06 #4
dtimes6
73 New Member
What type of data is the array. char? int? The array variable itself is nothing bat a pointer to that specified type.

int Slab[50]

Slab[20] = 100;
Slab[20] will give the value 100 and it is an integer

I will let you work the rest out.

I must admit that this has the feel of an unstudied university assignment about it.
There are far to many unqualified programmers with university degrees ;)

Study hard.
array is not eq to pointer!
Oct 17 '06 #5
dtimes6
73 New Member
See Peter van der Linden, Expert C Programming. for more details.
Oct 17 '06 #6
Banfa
9,065 Recognized Expert Moderator Expert
array is not eq to pointer!
No, but in a lot of situations they can be treated in the same mannor and I think this is one of them.

Expand|Select|Wrap|Line Numbers
  1. int *pointer = new int[50];
  2. int array[50];
  3.  
  4. /* This is all valid */
  5.  
  6. pointer[20] = 100;
  7. array[20] = 100;
  8.  
  9. *(p+21) = 101;
  10. *(array+21) = 101;
  11.  
  12. /* but */
  13.  
  14. if (sizeof pointer != sizeof array) // This is true
  15. {
  16.     cout << "Size of pointer and array are different!" << endl;
  17. }
  18.  
  19. /* and interestingly */
  20.  
  21.     delete[] pointer;
  22.     pointer = array;
  23.  
  24.     if (p == array) // This is true
  25.     {
  26.         cout << "p == array\n";
  27.     }
  28.  
  29.     if (&pointer != &array)  // This is true but in fact wont compile in C++ 
  30.                              // because &pointer and &array have different types
  31.     {
  32.         cout << "&p != &array\n";
  33.     }
  34.  
Oct 17 '06 #7

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

Similar topics

2
6417
by: hokieghal99 | last post by:
I wish to place all files and directories that are within a user defined path (on a Linux x86 PC) into some type of array and then examine those items for the existence of certain charaters such as...
7
9016
by: Kieran Simkin | last post by:
I have in my project in main.c a number of arrays defined like this (outside of any functions): char muser, mpass; I'm declaring them in a number of other .c files (inside functions) like this:...
2
2235
by: David | last post by:
Hi all, I am fairly new to C#. so go easy on me :-) Anyhow, I have a class file that I have set up properties and a method. I am calling this class file directly from and aspx.cs file. So...
2
1922
by: Michael Fitzpatrick | last post by:
I have a DLL written in C. This DLL reads a text file and creates a several very large arrays, 500,000 points and even larger. I would like the get the data in VB.Net so that I can plot it....
1
1265
by: cabral | last post by:
hello, i have a program that has 2 arrays but the info to be used in the array is in 2 text files... i want to know how to call the text files. please and thankyou
1
2430
by: Doug_J_W | last post by:
I have a Visual Basic (2005) project that contains around twenty embedded text files as resources. The text files contain two columns of real numbers that are separated by tab deliminator, and are...
10
2498
by: fmsguy06 | last post by:
I have the numbers 1 through 50 in one line on a text file, in random order. I am trying to read that text file into an array, so as to copy the array and sort it. I can copy and sort arrays fine,...
3
2438
by: erbrose | last post by:
Hello all! Newbie here, I've been tasked with a fairly intensive project here and my perl skills are still at a minimum so this post may eventually turn into a long one, but I am only going to ask...
1
1518
by: xHolyWrath | last post by:
Hi everyone! I'm new to this forum so any advise will be very much appreciated. I'm currently creating a C program that would read a text file full of integer values that represents pixel spectrum...
0
7055
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
7059
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
7103
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...
1
4799
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
4499
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
3011
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
3003
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1311
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
572
muto222
php
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.