I am trying to read data in to a struct from a prototype
My Code is: -
void init(student_record db[],int *count)
-
{
-
FILE *input;
-
char temp_str[30];
-
input = fopen("mydata.txt","r");
-
-
while(!feof(input) && count<SIZE)
-
{
-
fscanf_s(input,"%s",temp_str);
-
strcpy_s(db[*count].firstname,temp_str);
-
fscanf_s(input,"%s",temp_str);
-
strcpy_s(db[*count].lastname,temp_str);
-
fscanf_s(input,"%s",temp_str);
-
strcpy_s(db[*count].ssno,temp_str);
-
fscanf_s(input,"%s",temp_str);
-
strcpy_s(db[*count].city,temp_str);
-
fscanf_s(input,"%s",temp_str);
-
strcpy_s(db[*count].state,temp_str);
-
fscanf_s(input,"%s",temp_str);
-
strcpy_s(db[*count].year,temp_str);
-
fscanf_s(input,"%s",temp_str);
-
strcpy_s(db[*count].sex,temp_str);
-
fclose(input);
-
}
-
}
-
-
My complier is saying this:
error C2198: 'strcpy_s' : too few arguments for call
warning C4047: 'function' : 'rsize_t' differs in levels of indirection from 'char [30]'
warning C4024: 'strcpy_s' : different types for formal and actual parameter 2
Anyone have any ideas????
3 5645
I am trying to read data in to a struct from a prototype
My Code is: -
void init(student_record db[],int *count)
-
{
-
FILE *input;
-
char temp_str[30];
-
input = fopen("mydata.txt","r");
-
-
while(!feof(input) && count<SIZE)
-
{
-
fscanf_s(input,"%s",temp_str);
-
strcpy_s(db[*count].firstname,temp_str);
-
fscanf_s(input,"%s",temp_str);
-
strcpy_s(db[*count].lastname,temp_str);
-
fscanf_s(input,"%s",temp_str);
-
strcpy_s(db[*count].ssno,temp_str);
-
fscanf_s(input,"%s",temp_str);
-
strcpy_s(db[*count].city,temp_str);
-
fscanf_s(input,"%s",temp_str);
-
strcpy_s(db[*count].state,temp_str);
-
fscanf_s(input,"%s",temp_str);
-
strcpy_s(db[*count].year,temp_str);
-
fscanf_s(input,"%s",temp_str);
-
strcpy_s(db[*count].sex,temp_str);
-
fclose(input);
-
}
-
}
-
-
My complier is saying this:
error C2198: 'strcpy_s' : too few arguments for call
warning C4047: 'function' : 'rsize_t' differs in levels of indirection from 'char [30]'
warning C4024: 'strcpy_s' : different types for formal and actual parameter 2
Anyone have any ideas????
"strcpy" (string copy) thorws error on integer and float variables... ! check on it may be!
Sign in to post your reply or Sign up for a free account.
Similar topics
by: travis ray |
last post by:
Hi,
I have an extension in which a file object is created in python and
passed down to a c extension which attempts to read from it or write
to it. Writing to the file pointer seems to work...
|
by: fabrice |
last post by:
Hello,
I've got trouble reading a text file (event viewer dump) by using the
getline() function...
After 200 - 300 lines that are read correctly, it suddenly stops
reading the rest of the...
|
by: SB |
last post by:
Hello. I have an input file which is laid out in the following manner...
Name
Day 1
am time 1
am time 2
appointment
pm time 1
pm time 2
appointment
Day 2
|
by: ishmael4 |
last post by:
hello everyone!
i have a problem with reading from binary file. i was googling and
searching, but i just cant understand, why isnt this code working. i could
use any help. here's the source code:...
|
by: Magnus |
last post by:
allrite folks, got some questions here...
1) LAY-OUT OF REPORTS
How is it possible to fundamentaly change the lay-out/form of a report in
access? I dont really know it that "difficult", but...
|
by: John Dann |
last post by:
I'm trying to read some binary data from a file created by another
program. I know the binary file format but can't change or control the
format. The binary data is organised such that it should...
|
by: arne.muller |
last post by:
Hello,
I've come across some problems reading strucutres from binary files.
Basically I've some strutures
typedef struct {
int i;
double x;
int n;
double *mz;
|
by: blazedaces |
last post by:
Ok, so you know my problem, java is running out of memory reading with SAX, the event-based xml parser intended more-so than DOM for extremely large files. I'll try to explain what I've been doing...
|
by: swetha |
last post by:
HI Every1,
I have a problem in reading a binary file.
Actually i want a C program which reads in the data from a file which
is in binary format and i want to update values in it.
The file...
|
by: efrenba |
last post by:
Hi,
I came from delphi world and now I'm doing my first steps in C++. I'm
using C++builder because its ide is like delphi although I'm trying to
avoid the vcl.
I need to insert new features...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
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$) {
}
...
|
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...
|
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...
|
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
|
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,...
|
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...
|
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: 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...
| |