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 as argument, but probably i'm mistaking it ... can anybody help me?
#include <stdio.h>
#include <string.h>
main ()
{
int i;
char j;
char *ip;
for (i = 0; i < 10; i++)
{
ip=&j;
for (j = 0; j<3; j++)
{
FILE *fp;
char filename[17] ;
if (i == 0)
{
strcpy(filename , "injection-0");
if (j==0) strcat(filename ,"_11.txt"); else if (j==1) strcat (filename,*ip);
else if (j==2) strcat (filename,"_12. txt");
}
if ((fp = fopen(filename, "w")) != NULL)
{
fprintf(fp, "mass_part mass_flow_part diam_part accretion surf_ID cel_ID temp vel_abs vel_nor vx vy vz Ax Ay Az Angle Wa Wb Wc WEAR\n");
fclose(fp);
}
}
}
}
1 1804
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 as argument, but probably i'm mistaking it ... can anybody help me?
#include <stdio.h>
#include <string.h>
main ()
{
int i;
char j;
char *ip;
for (i = 0; i < 10; i++)
{
ip=&j;
for (j = 0; j<3; j++)
{
FILE *fp;
char filename[17] ;
if (i == 0)
{
strcpy(filename , "injection-0");
if (j==0) strcat(filename ,"_11.txt"); else if (j==1) strcat (filename,*ip);
else if (j==2) strcat (filename,"_12. txt");
}
if ((fp = fopen(filename, "w")) != NULL)
{
fprintf(fp, "mass_part mass_flow_part diam_part accretion surf_ID cel_ID temp vel_abs vel_nor vx vy vz Ax Ay Az Angle Wa Wb Wc WEAR\n");
fclose(fp);
}
}
}
}
- else if (j==1) strcat (filename,ip);
I don't believe you have to dereference the pointer.
Sign in to post your reply or Sign up for a free account.
Similar topics |
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"; //This outputs "GET /path/test.htm HTTP/1.1" happily
//Send packet (I know there's no error checking, this is just an example)
|
by: Jon |
last post by:
using Borland Compiler.
x = "this is a string"
strcat(x,x)
strcat(x,x)
will produce "this is a stringthis is a stringthis is a stringthis is
a stringt"
|
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 am
having trouble fixing(program below)
The idea of the program is to convert input(integers) into words eg:
# 101
returns
#one hundred one
I have found the problem is with the strcat of the strings & literals --
|
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 strcat
(mystract). Program below.
However this appears not to have fixed the problem and I don't know why it
shouldn't ?
Any further help as to what else I am doing wrong will be appreciated
regards
|
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 "c is abcd" .
#include <stdio.h>
#include <string.h>
void main() {
char a="ab";
char b="cd";
| |
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 the library, and other resources
related to managed strings are available for download from the CERT web
site at:
http://www.cert.org/secure-coding/managedstring.html
|
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*/
|
by: sail0r |
last post by:
Perhaps this is obvious but I am not sure what is going on...
Here is the relevant code:
char *command;
char *argument;
char url="file:///usr/u/myname/Project/cats/";
char target_path="/tmp/abc";
command=strtok(buf,":\n\r");
argument=strtok(NULL,"\n\r");
|
by: Mahesh |
last post by:
Hi,
I am looking for efficient string cancatination c code. I did it using
ptr but my code i think is not efficient.
Please help.
Thanks a lot
|
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...
|
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,...
| |
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...
|
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,...
|
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...
|
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...
|
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 then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
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
| |