473,803 Members | 3,195 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Output file prob

Savage
1,764 Recognized Expert Top Contributor
I'm making for fun a simple program which format a input file.Input file sustain of
person name,lastname and date of birth.Output file si supposed to be forammted as following:

NAME LASTNAME DATE OF BIRTH

And i finished it but there is little prob: it don't output date of birth!

I thinkt about the prob and can't figure out why is that happening.

To output data i used function: void output(void),i have also created a struct:
Expand|Select|Wrap|Line Numbers
  1. typedef struct person{
  2.                                            char lastname[20];
  3.                                            char firstname[20];
  4.                                            char dob[10];
  5.                                }Tperson;
And here is a problem:

Expand|Select|Wrap|Line Numbers
  1. Tperson person;
  2.  
  3. while((!feof(data))&&(fgets(string,80,data)!=NULL))
  4. {
  5.      i=0;
  6.      j=0;
  7.     /*part with NAME and LAST name is working just fine so I don't think that   
  8.       this part is necsasary.*/
  9.      while(string[i]!=' '&&string[i]!='\t'&&string[i]!='\n')
  10.      {
  11.            temporary[j]=string[i];
  12.            i++;
  13.            j++;
  14.       }
  15.       temporary[j]='\0';
  16.       strcpy(person.dob,temporary);
  17.       fprintf(out,"\n %10s  %10s  %
  18.       6s  ",person.firstname,person.lastname,person.dob);
  19.  
  20. }
Did anyone noticed where did I went wrong??

Savage
Mar 31 '07 #1
0 1406

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

Similar topics

17
2096
by: tom | last post by:
Hello, got a prob with renaming a file; still don't know where is the mistake. this is the code: <% '*************************************************************************** * file_orig=session("nome_file") file_copy=session("id_risp") & "_" & session("id_recl") 'path_copy=Server.Mappath("/document/" & file_copy & ".doc")
5
4985
by: David Sobey | last post by:
Hi Sorry bout this basic prob. Got a file called file.obj. tryna read the first line from it as a string and print it to the screen. getting errors: #include "stdafx.h" #include <stdio.h> #include <fstream.h> #include <iostream.h> #include <string>
3
1611
by: Chad | last post by:
I was wondering what the best method of updating a file was. heres my prob, ive got a file with say 1million urls and I want to take the first 10,000 and store them in memory. I want to 10k of urls to be taken out an the file to be updated. is there anyway i could move the beggining of the file?? What would b the most efficient way of updating the file?? thanks for any help in advanced.
8
3296
by: Stewart | last post by:
is there any way this can be done? I've looked at the help files and checked out as many tutorials as i could find on the net (as always) but no joy. thanks
1
1916
by: Jagadeesh | last post by:
hi , Am trying to read from and write to a same xml file.i have no prob when reading the xml file.but when i write to the same file i get the following error even after closing the reader object(which is open). The file is being used by some other process. ---------------------------------------------------
12
1685
by: unique | last post by:
I have written some programs in c lang yet but today I get confused with output i get. I have function educate(..) which i call in main program this way: J = educate(no_layers, no_neurons, input, output, lay, weights, 0.1,0); printf("J= %f\n",J); In the educate function i count J and i return it (but before I return it I output it with printf):
4
12812
by: Amit Maheshwari | last post by:
I need to read text file having data either comma seperated or tab seperated or any custom seperator and convert into a DataSet in C# . I tried Microsoft Text Driver and Microsoft.Jet.OLEDB.4.0 to read text file but could not get the data in correct format. All columns are not coming in dataset and rows are messing up. Suggestions please ???
7
3191
by: pbd22 | last post by:
hi. i am having probs understanding how to grab a file being uploaded from a remote client. i am using hidden input fields for upload such as: <input id="my_file_element" type="file" name="file_1" size=46 /><input type=submit /> so, after adding a few files, the input fields look like this:
2
1519
by: mnacw | last post by:
Can anybody help me to resolve this prob. i have installed Visual Studio 2005 Professional edition. I am working in VB.Net. When I tried to connect to database it is connected but when i make some changes in table and try to update it does not work. It does not give any error. It seems like all fine. but when I retrieve the data via application menas data grid control on form. shows only previous data. no updates. i am using acess...
0
9699
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9562
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10542
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10289
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10068
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9119
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7600
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
4274
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 we have to send another system
3
2968
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.