473,387 Members | 1,504 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,387 software developers and data experts.

strcat Help

Hi All,

I am new with c and would like some help.
When reading a bin file the year is 06, the decimal value = 6 so I use the &rawtime to determine the year and then
cat it with the array (xya[j]) so that the result will printf 2006 and do this with the month as well as the day.
How can I strcat the "strncpy(datum,(char *)(ctime (&rawtime))+20,3);" (200) with the xya[j] array??????
Whenever I compile with gcc there are errors :
C.Fopen.c:170: warning: passing arg 2 of `strncat' makes pointer from integer without a cast
oC.Fopen.c:170: too few arguments to function `strncat'
What am I doing wrong or is there any other way to do this.

if(length < 10)
{
time (&rawtime);
if (xya[j]<10)
{
strncpy(datum,(char *)(ctime (&rawtime))+20,3);
datum[3]='\0';
}
else
{
strncpy(datum,(char *)(ctime (&rawtime))+20,2);
datum[2]='\0';
datum[3]='\0';
}
printf("XXXXX %s XXXXXX",datum);
strcat(datum,xya[j]);
// cat 200 with xya[j] (6) = 2006
}
//printf(" %d Len",length);
//printf("%x",xya[j]);
//printf(" Len %d ",length);

Many Thanks
Chris
Jun 4 '06 #1
1 2500
Hi All,

Is my explanation not clear enough please let me know so that I can clarify.

Thanks
Jun 4 '06 #2

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

Similar topics

14
by: Patrick Coleman | last post by:
Hi, I have the following code: char request = "GET "; strcat(request, path); //Path is the path section of a url ie. "/path/test.htm" strcat(request, " HTTP/1.1"); cout<<request<<"\n";...
5
by: Ian Stanley | last post by:
Hi, Having not done any C programming for a while I am trying to get back into it by converting an old java assignment into C. The problem is I am getting a segmentation fault at runtime which I...
18
by: Ian Stanley | last post by:
Hi, Continuing my strcat segmentation fault posting- I have a problem which occurs when appending two sting literals using strcat. I have tried to fix it by writing my own function that does the...
23
by: JC | last post by:
hi, i want to combine two string together.. and put in to another string. how can i do . i try myself.. with the follow code. but seem can't get the result i want.. i want to get the result with...
81
by: Matt | last post by:
I have 2 questions: 1. strlen returns an unsigned (size_t) quantity. Why is an unsigned value more approprate than a signed value? Why is unsighned value less appropriate? 2. Would there...
9
by: cicalese | last post by:
For starters, I am a C novice. I don't fully understand how strings work. I am running on a linux box. I compile w/ gcc. I have a string called 'myabqcommand' that is being overwritten when i use...
16
by: Lilith | last post by:
I'm working on a simple piece of code under VC++ 6.0. I've got a char Buffer array into which I copy the contents of an MFC control. The string is properly nul terminated. I use strcat (Buffer,...
87
by: Robert Seacord | last post by:
The SEI has published CMU/SEI-2006-TR-006 "Specifications for Managed Strings" and released a "proof-of-concept" implementation of the managed string library. The specification, source code for...
4
by: nick048 | last post by:
Hi, I have this problem: int n; char nToChar; char firstString = "The number is: "; char resp; /* HERE MAIN WITH THE INPUT OF n*/
1
by: Frusciante | last post by:
Hi! I wanted to thank you a lot for the help given yesterday... It`s so great to have people so well prepared trying to help you! I have another problem: the bold line : strcat want a pointer...
0
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,...
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:
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
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...
0
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...

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.